A pair of integers p and p+2 are said to be Twin Primes if both p and p+2 are primes. You will
find below a Mathematica script that will find all Twin Prime pairs that are less than a certain
integer m and count these pairs. The code is structured as follows:
twinp [m]:= (Statement1: v={}; Do [If [statement2 && statement 3, statement4; s=s+1], Statement 5];
Print ["all Twin Prime pairs that are less than", m, " are: ", statement6];
Print ["Their number is", Statement 7]:)
1. Statement 1 is:
a.s=0
b.s<0
c.s=0
d.s:=0
2. Statement 2 is:
a. PrimeQ[i]
b.Prime[i]
c.Primeq[i]
d. None
3. Statement 4 is:
a. v=Append[v, {i, i+1}]
b. v={i,i+1}
c. v=Append[{i, i+1}]
d. None
4. statement 5 is:
a. {i,1:m}
b. {i,1:m-3}
c. {i, 1, m-3}
d. {i,0,m-1}
5. statement 7 is:
a. v
b. s
c. length[v]
d. None
6. The number of twin primes
less than 1000 is
a. 25
b. 35
c. 20
d. None
a
b
c
d