login
a(n) is the least prime p such that the next prime after p with the same last digit as p is p+10*n.
1

%I #28 Jan 21 2021 22:16:50

%S 3,11,29,313,113,397,331,269,997,1129,2861,4271,4657,13451,10687,

%T 31489,14969,10891,38011,63113,39397,70621,55373,57331,46273,141863,

%U 78283,130987,99233,27283,379081,711371,349471,474583,701033,155893,285997,250307,988937,869551,1118441,425417,2385157

%N a(n) is the least prime p such that the next prime after p with the same last digit as p is p+10*n.

%H Robert Israel, <a href="/A328550/b328550.txt">Table of n, a(n) for n = 1..100</a>

%e a(3) = 29 because the next prime after 29 ending in 9 is 29+3*10=59.

%p V:= Vector(50): count:= 0:

%p L:= Vector(9):

%p p:= 2:

%p while count < 50 do

%p p:= nextprime(p);

%p d:= p mod 10;

%p if L[d] = 0 then L[d]:= p

%p else

%p m:= (p - L[d])/10;

%p if m <= 100 and V[m] = 0 then

%p V[m]:= L[d]; count:= count+1;

%p fi;

%p L[d]:= p;

%p fi

%p od:

%p convert(V,list);

%K nonn,base

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Jan 19 2021