OFFSET
1,2
COMMENTS
Lists all positive integers except for the terms of A076150 (which start with 114).
From Robert Israel, Jan 20 2016: (Start)
Here is a proof of this claim.
The only way positive integer x can fail to occur is that eventually all terms end in digits d such that x+d is composite. Let S be the set of residue classes mod 10 that contain infinitely many terms of the sequence. Since the sequence is infinite, S is nonempty. Since there are infinitely many primes in each of the residue classes 1,3,7,9 mod 10, S is closed under the operations t -> 1-t, t -> 3-t, t -> 7-t, t -> 9-t (all mod 10). Using these operations we have a cycle 0 -> 1 -> 2 -> 5 -> 4 -> 7 -> 6 -> 3 -> 8 -> 9 -> 0 containing all 10 residue classes. Thus S consists of all 10 residue classes, which means the only way x can fail to occur is that x+0, ..., x+9 are all composite. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
E. Angelini, J. Mason and M. F. Hasler, A light variation, SeqFan list, Jan. 20, 2016
MAPLE
N:= 1000: # to get terms before the first term > N
V:= Vector(N):
Primes:= select(isprime, [2, seq(i, i=3..N, 2)]):
A[1]:= 1:
V[1]:= 1:
for n from 2 do
t:= A[n-1] mod 10;
r:= select(j -> j > 0 and V[j] = 0, map(`-`, Primes, t));
if r = [] then break fi;
A[n]:= r[1];
V[r[1]]:= 1;
od:
seq(A[i], i=1..n-1); # Robert Israel, Jan 20 2016
MATHEMATICA
a = {1}; Do[k = 1; While[Or[MemberQ[a, k], ! PrimeQ[Last@ IntegerDigits@ a[[n - 1]] + k]], k++]; AppendTo[a, k], {n, 2, 91}]; a (* Michael De Vlieger, Jan 20 2016 *)
PROG
(PARI) {A267299(n, show=0, a=1/*first term*/, u=0, L=1)=for(n=1, n-1, show&&print1(a", "); bittest(u+=1<<a, L)&&L++; for(k=L, 9e9, !bittest(u, k)&&isprime(k+a%10)&&(a=k)&&break)); if(type(show)=="t_VEC", [a, L, u], a)} \\ Use show=1 to print the list, [] or [1] to return also the least unused (L) and bitmap of used numbers (u).
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and M. F. Hasler, Jan 20 2016
STATUS
approved