login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #15 Jan 02 2023 12:30:52

%S 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,

%T 27,24,25,26,31,30,37,34,33,38,35,36,41,40,43,44,39,50,47,46,53,56,55,

%U 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

%N 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.

%C Lists all positive integers except for the terms of A076150 (which start with 114).

%C From _Robert Israel_, Jan 20 2016: (Start)

%C Here is a proof of this claim.

%C 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)

%H Robert Israel, <a href="/A267299/b267299.txt">Table of n, a(n) for n = 1..10000</a>

%H E. Angelini, J. Mason and M. F. Hasler, <a href="http://list.seqfan.eu/oldermail/seqfan/2016-January/015968.html">A light variation</a>, SeqFan list, Jan. 20, 2016

%p N:= 1000: # to get terms before the first term > N

%p V:= Vector(N):

%p Primes:= select(isprime, [2,seq(i,i=3..N,2)]):

%p A[1]:= 1:

%p V[1]:= 1:

%p for n from 2 do

%p t:= A[n-1] mod 10;

%p r:= select(j -> j > 0 and V[j] = 0, map(`-`,Primes,t));

%p if r = [] then break fi;

%p A[n]:= r[1];

%p V[r[1]]:= 1;

%p od:

%p seq(A[i],i=1..n-1); # _Robert Israel_, Jan 20 2016

%t 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 *)

%o (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).

%K nonn,base

%O 1,2

%A _Eric Angelini_ and _M. F. Hasler_, Jan 20 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 10:51 EDT 2024. Contains 371967 sequences. (Running on oeis4.)