login
A371403
Least k such that prime(k), prime(k+1), prime(k+2), ..., prime(k+n) all have the same last digit.
0
34, 258, 2147, 11582, 62192, 274810, 1500309, 2235294, 10919138, 24000612, 3074210315, 6244442805, 6244442805
OFFSET
1,1
COMMENTS
The interest in studying a sequence of n consecutive prime numbers having the same last digit is to look at the behavior of the rarefaction of these numbers when n becomes large.
a(k) > 10^10 for k >= 14. - David A. Corneth, Mar 22 2024
EXAMPLE
a(1) = A107730(1) = 34 because prime(34) = 139, prime(35) = 149, both end with the digit 9, and no two consecutive smaller primes end with the same digit.
a(2) = 258 because prime(258) = 1627, prime(259) = 1637, prime(260) = 1657 with the same last digit 7, and no three consecutive smaller primes have the same last digit.
a(4) = A371390(1).
MAPLE
nn:=15*10^6:
for n from 2 to 7 do :
ii:=0:d:=array(1..n):
for m from 1 to nn while(ii=0)
do:
lst:={}:
for k from 1 to n do:
d[k]:=irem(ithprime(m+k-1), 10):
lst:=lst union {d[k]}:
od:
if lst={d[1]}
then
printf(`%d %d \n`, n-1, m):ii:=1:
else
fi:
od:
od:
MATHEMATICA
a[n_] := Module[{v = Mod[Prime[Range[n + 1]], 10], k = 1, p}, p = Prime[n + 1]; While[! SameQ @@ v, p = NextPrime[p]; v = Join[Rest[v], {Mod[p, 10]}]; k++]; k]; Array[a, 6] (* Amiram Eldar, Mar 21 2024 *)
PROG
(PARI)
upto(n) = {
n += 30;
my(res = List(), q = 2, t = 1, ld = 2, nld, streak = 0);
forprime(p = 3, oo,
nld = p%10;
if(nld == ld,
streak++;
if(streak > #res,
listput(res, t-streak+1);
print1(t-streak+1", ");
)
,
streak = 0
);
q = p;
ld = nld;
t++;
if(t > n,
return(res);
)
);
res
} \\ David A. Corneth, Mar 23 2024
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Michel Lagneau, Mar 21 2024
EXTENSIONS
a(7)-a(10) from Amiram Eldar, Mar 21 2024
a(11)-a(13) from David A. Corneth, Mar 22 2024
STATUS
approved