login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A366310
First of a sequence of exactly n consecutive primes whose squares have the same last digit.
0
2, 13, 43, 157, 401, 2969, 7237, 30697, 57397, 68239, 576019, 967019, 225769, 6590069, 10942949, 21235127, 57401779, 186564317, 154836067, 117219967, 2598759227, 7470538489, 28594410847, 59107046659, 240456558467, 34511350409, 193861351357, 249423946921, 368059259143
OFFSET
1,1
COMMENTS
a(n) > 4.5*10^11 for n >= 30. - David A. Corneth, Oct 07 2023
EXAMPLE
a(3) = 43 because the 3 consecutive primes 43, 47, 53 all have squares ending in 9, while the primes 41 and 59 preceding 43 and following 53 have squares ending in 1.
MAPLE
N:= 16: # for a(1) .. a(N)
V:= Vector(N):
p:= 2: q:= 2: count:= 0: d:= 4: i:= 1:
while count < N do
p:= nextprime(p);
if p^2 mod 10 <> d then
if i <= N and V[i] = 0 then
V[i]:= q; count:= count+1;
fi;
q:= p; i:= 1; d:= p^2 mod 10;
else
i:= i+1;
fi
od:
convert(V, list);
PROG
(PARI)
upto(n) = {
my(res = [], ld = 4, streak = 1);
forprime(p = 3, n,
nd = p^2 % 10;
if(nd == ld,
streak++
,
if(streak > #res,
res = concat(res, vector(streak - #res, i, oo))
);
if(res[streak] == oo,
c = p;
for(i = 1, streak,
c = precprime(c-1);
);
res[streak] = c;
);
streak = 1;
);
ld = nd
); res
} \\ David A. Corneth, Oct 07 2023
CROSSREFS
Cf. A054681.
Sequence in context: A248198 A102296 A296807 * A308731 A025194 A084156
KEYWORD
nonn,base
AUTHOR
Robert Israel and the late J. M. Bergot, Oct 06 2023
EXTENSIONS
More terms from David A. Corneth, Oct 07 2023
STATUS
approved