A073673 Rearrangement of natural numbers such that every partial product + 1 is a prime.
1, 2, 3, 5, 6, 9, 4, 7, 10, 17, 12, 11, 13, 8, 19, 27, 21, 26, 20, 16, 14, 28, 22, 18, 47, 30, 31, 23, 34, 37, 41, 45, 49, 33, 36, 58, 24, 62, 39, 56, 42, 93, 54, 25, 51, 53, 15, 70, 72, 73, 46, 50, 64, 97, 55, 57, 171, 96, 79, 81, 66, 71, 132, 89, 121, 29, 61, 60, 177, 32
Offset: 1
Keywords
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..1600 (terms 751..954 from Bill McEachen, 1..750 from Robert G. Wilson v)
Programs
-
Mathematica
f[s_List] := Block[{k = 1, p = Times @@ s}, While[ MemberQ[s, k] || !PrimeQ[k*p + 1], k++]; Append[s, k]]; Nest[f, {1}, 69] (* Robert G. Wilson v, Dec 24 2012 *)
-
PARI
v=[1];n=1;while(n<100,s=1+n*prod(i=1,#v,v[i]);if(isprime(s)&&!vecsearch(vecsort(v),n),v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 16 2015
-
Python
from gmpy2 import is_prime from itertools import islice def agen(startp=1, startset=set()): # generator of terms aset, p, mink = startset, startp, 1 while True: an = mink while an in aset or not is_prime(p*an + 1): an += 1 yield an; aset.add(an); p *= an while mink in aset: aset.discard(mink); mink += 1 print(list(islice(agen(), 70))) # Michael S. Branicky, May 19 2023
Formula
Conjecture: n/log(n) << a(n) << n*log(n). - Thomas Ordowski, Aug 09 2017
Extensions
More terms from Sascha Kurz, Feb 01 2003
Comments