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