A083771 Rearrangement of primes such that every partial product + 1 is a prime.
2, 3, 5, 7, 11, 19, 29, 13, 59, 37, 31, 47, 67, 53, 41, 97, 73, 113, 103, 43, 71, 233, 61, 151, 109, 101, 251, 107, 587, 79, 223, 167, 311, 239, 137, 139, 359, 181, 257, 337, 163, 173, 881, 563, 149, 409, 157, 179, 293, 127, 331, 191, 269, 317, 83, 277, 23, 821, 373, 271, 283, 461, 569, 853, 487, 433, 647, 953, 383, 199, 367, 1231, 397, 307, 457, 691, 523, 463, 1061, 281, 787, 421, 197, 857, 1103, 347, 631, 499, 991, 643, 769, 983, 607, 811, 449, 1223, 733, 1327, 683, 1021
Offset: 1
Keywords
Examples
The n-th term is the smallest prime that is not already in the sequence, such that one plus the product of the first n terms is prime. [_Dmitry Kamenetsky_, Mar 12 2009]
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..700 (first 100 terms from Amarnath Murthy and Meenakshi Srikanth)
Crossrefs
Cf. number of primality tests required for each term in this sequence is in A158076. [Dmitry Kamenetsky, Mar 12 2009]
Programs
-
Mathematica
f[s_List] := Block[{p = Times @@ s, q = 2}, While[ MemberQ[s, q] || !PrimeQ[p*q + 1], q = NextPrime@ q]; Append[s, q]]; Nest[f, {2}, 63] (* Robert G. Wilson v, Jul 20 2017 *)
-
PARI
{ terms=100; a=A083772=vector(terms); a[1]=2; tmp=1; A083772[1]=3; for(k=2,terms, tmp=tmp*a[k-1]; p=1; while(1, until(isprime(p), p=p+2); for(m=1,k-1, if(p==a[m], break, if(m==k-1, if(isprime(tmp*p+1), a[k]=p; A083772[k]=tmp*p+1; print1(a[k],","); break(2))))))); a }
Extensions
More terms from Rick L. Shepherd, Mar 18 2004
Comments