A254337 Lexicographically earliest sequence of distinct numbers such that no sum of consecutive terms is prime.
0, 1, 8, 6, 10, 14, 12, 4, 20, 16, 24, 18, 22, 28, 26, 34, 30, 32, 36, 40, 42, 46, 38, 44, 52, 48, 54, 50, 58, 56, 62, 64, 60, 66, 68, 72, 70, 74, 80, 76, 78, 86, 82, 84, 90, 92, 94, 88, 98, 96, 104, 100, 102, 108, 110, 112, 114, 106, 116, 122, 118, 120, 124, 126, 130, 132, 134, 128, 138, 136, 142, 140, 144, 146, 148, 150, 154, 152, 156, 158
Offset: 0
Examples
To explain the beginning of the sequence, observe that starting with the smallest possible terms 0, 1 does not appear to lead to a contradiction (and in fact never does), so we start there. The next composite would be 4 but 1+4=5 is prime, as is 1+6, but 1+8=9 is not, so we take a(2) = 8 to be the next term. 4 is impossible for a(3) since 1+8+4=13 is prime, but neither 1+8+6=15 nor 8+6 is prime, so a(3)=6.
Links
- Robert G. Wilson v and M. F. Hasler, Table of n, a(n) for n = 0..5000 (terms 0..999 from M. F. Hasler)
Crossrefs
Programs
-
Mathematica
f[lst_List] := Block[{k = 1}, While[ PrimeQ@ k || MemberQ[lst, k] || Union@ PrimeQ@ Accumulate@ Reverse@ Join[lst, {k}] != {False}, k++]; Append[lst, k]]; Nest[f, {0}, 70] (* Robert G. Wilson v, Jan 31 2015 *)
-
PARI
a=[];u=0; for(i=1,99, a=concat(a,0); until( ! isprime(s) || ! a[i]++, while( isprime(a[i]) || bittest(u,a[i]), a[i]++); s=a[k=i]; while( k>1 && ! isprime( s+=a[k--]),)); u+=2^a[i]; print1(a[i]","))
Formula
It appears that a(n) ~ 2n.
Comments