

A267299


a(n+1) = least positive integer not occurring earlier which yields a prime when added to the last digit of a(n); a(1) = 1.


3



1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 11, 12, 15, 14, 13, 16, 17, 22, 21, 18, 23, 20, 19, 28, 29, 32, 27, 24, 25, 26, 31, 30, 37, 34, 33, 38, 35, 36, 41, 40, 43, 44, 39, 50, 47, 46, 53, 56, 55, 42, 45, 48, 51, 52, 57, 54, 49, 58, 59, 62, 65, 66, 61, 60, 67, 64, 63, 68, 71, 70, 73, 76, 77, 72, 69, 74, 75, 78, 81, 82, 87, 90, 79, 80, 83, 86, 91, 88, 89, 92, 95
(list;
graph;
refs;
listen;
history;
text;
internal format)



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 > 1t, t > 3t, t > 7t, t > 9t (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[n1] 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..n1); # 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, n1, 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

Sequence in context: A122989 A222246 A321726 * A077223 A265369 A267308
Adjacent sequences: A267296 A267297 A267298 * A267300 A267301 A267302


KEYWORD

nonn,base


AUTHOR

Eric Angelini and M. F. Hasler, Jan 20 2016


STATUS

approved



