A329450 Lexicographically earliest sequence of distinct nonnegative integers such that neither a(n) + a(n+1) nor a(n) + a(n+2) is prime for any n.
0, 1, 8, 7, 2, 13, 12, 3, 6, 9, 15, 5, 10, 4, 11, 14, 16, 18, 17, 21, 19, 23, 25, 26, 20, 22, 24, 27, 28, 29, 34, 31, 32, 33, 30, 35, 39, 37, 38, 40, 36, 41, 44, 43, 42, 45, 46, 47, 48, 51, 54, 57, 58, 53, 52, 59, 56, 49, 50, 55, 60, 61, 62, 63, 66, 67, 68, 65, 64, 69, 71, 72, 70, 73, 74, 79, 76
Offset: 0
Keywords
Examples
After the smallest possible initial terms, a(0) = 0, a(1) = 1, the next term must be neither a prime nor a prime - 1. The smallest possibility is a(2) = 8. The next term must not be a prime - 1 nor a prime - 8, which excludes 2, 4, 6 on one hand, and 3 and 5 on the other hand. The smallest possibility is a(3) = 7.
Links
- Eric Angelini, Prime sums from neighbouring terms, personal blog "Cinquante signes" (and post to the SeqFan list), Nov. 11, 2019.
- Eric Angelini, Prime sums from neighbouring terms [Cached copy of html file, with permission]
- Eric Angelini, Prime sums from neighbouring terms [Cached copy of pdf file, with permission]
- M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
Crossrefs
Programs
-
Mathematica
Nest[Block[{k = 2}, While[Nand[FreeQ[#, k], ! PrimeQ[#[[-1]] + k], ! PrimeQ[#[[-2]] + k]], k++]; Append[#, k]] &, {0, 1}, 89] (* Michael De Vlieger, Nov 15 2019 *)
-
PARI
A329450(n,show=0,o=0,p=o,U=[])={for(n=o,n-1, show&&print1(p","); U=setunion(U,[p]); while(#U>1&&U[1]==U[2]-1, U=U[^1]); for(k=U[1]+1,oo, setsearch(U,k) || isprime(o+k) || isprime(p+k) || [o=p, p=k, break]));p} \\ Optional args: show=1: print a(o..n-1); o=1: start with a(1) = 1 (A329405). See the wiki page for more general code returning a vector: S(n,0,3) = A329450(0..n-1).
Extensions
Edited by N. J. A. Sloane, Nov 14 2019
New definition corrected by M. F. Hasler, Nov 15 2019
Comments