A329405 Among the pairwise sums of any three consecutive terms there is no prime: lexicographically earliest such sequence of distinct positive integers.
1, 3, 5, 7, 9, 11, 13, 14, 2, 4, 6, 8, 10, 12, 15, 18, 17, 16, 19, 20, 25, 24, 21, 27, 23, 22, 26, 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, 77, 78
Offset: 1
Keywords
Examples
a(1) = 1 from minimality. a(2) = 3 since 2 would produce 3 (a prime) by making 1 + 2. a(3) = 5 since 2 or 4 would produce a prime (e.g., 3 + 4 = 7). a(4) = 7 since 2, 4 or 6 would produce a prime (e.g., 5 + 6 = 11). ... a(8) = 14 as 2, 4, 6, 8, 10 or 12 would produce a prime together with a(7) = 13 or a(6) = 11. a(9) = 2 as neither 2 + 13 = 15 nor 2 + 14 = 16 is prime. And so on.
Links
- Jean-Marc Falcoz, Table of n, a(n) for n = 1..10000
- M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
Crossrefs
Programs
-
Mathematica
a[1]=1;a[2]=3;a[n_]:=a[n]=(k=1;While[Or@@PrimeQ[Plus@@@Subsets[{a[n-1],a[n-2],++k},{2}]]||MemberQ[Array[a,n-1],k]];k);Array[a,100] (* Giorgos Kalogeropoulos, May 09 2021 *)
-
PARI
A329405(n, show=1, o=1, 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=0: don't print the list; o=0: start with a(0) = 0, i.e., compute A329450. See the wiki page for more general code returning a vector: S(n,0,3,1) = a(1..n).
Extensions
Edited by N. J. A. Sloane, Nov 15 2019
Comments