login
Rearrangement of primes such that every partial product + 1 is a prime.
8

%I #26 Mar 02 2019 20:13:39

%S 2,3,5,7,11,19,29,13,59,37,31,47,67,53,41,97,73,113,103,43,71,233,61,

%T 151,109,101,251,107,587,79,223,167,311,239,137,139,359,181,257,337,

%U 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

%N Rearrangement of primes such that every partial product + 1 is a prime.

%C Though initial terms match it is different from A039726, in that a smaller prime may appear later.

%C Some of the larger entries may only correspond to probable primes.

%C A158076 suggests that the numbers in this sequence can be generated quite easily/quickly. Perhaps this sequence is a fast method to generate large probable primes. [_Dmitry Kamenetsky_, Mar 12 2009]

%C Records: 2, 3, 5, 7, 11, 19, 29, 59, 67, 97, 113, 233, 251, 587, 881, 953, 1231, 1327, 1553, 1657, 2383, 3251, 3769, 6737, 6947, 7103, 7879, 8263, 10159, 11369, 22003, ..., . - _Robert G. Wilson v_, Jul 20 2017

%C Position of the n_th prime: 1, 2, 3, 4, 5, 8, 472, 6, 57, 7, 11, 10, 15, 20, 12, 14, 9, 23, 13, 21, 17, 30, 55, 478, 16, 26, 19, 28, 25, 18, 50, 345, 35, 36, 45, 24, ..., . - _Robert G. Wilson v_, Jul 20 2017

%H Robert G. Wilson v, <a href="/A083771/b083771.txt">Table of n, a(n) for n = 1..700</a> (first 100 terms from Amarnath Murthy and Meenakshi Srikanth)

%e 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]

%t 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 *)

%o (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 }

%Y Cf. A005235, A039726, A083772.

%Y Cf. number of primality tests required for each term in this sequence is in A158076. [_Dmitry Kamenetsky_, Mar 12 2009]

%K nonn

%O 1,1

%A _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 06 2003

%E More terms from _Rick L. Shepherd_, Mar 18 2004