login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the least prime that is the concatenation of n squares, where the concatenations of the last k of these squares are prime for 2 <= k <= n.
0

%I #15 Oct 22 2023 01:25:24

%S 11,419,4919,181919,1981919,49936919,991981919,9991981919,

%T 16999369225919,136999369225919,99361981818199181,1729936999369225919,

%U 3681225936999369225919,132481225936999369225919,99362500576936999369225919,8199362500576936999369225919

%N a(n) is the least prime that is the concatenation of n squares, where the concatenations of the last k of these squares are prime for 2 <= k <= n.

%C At most 2 of the n squares are not divisible by 9.

%e a(5) = 181919 because it is the concatenation of five squares 1^2 = 1, 9^2 = 81, 3^2 = 9, 1^2 = 1 and 3^2 = 9, and 19, 919, 81919 and 181919 are all prime, and this is the least number that works.

%p for d from 1 to 8 do

%p m1:= ceil(10^((d-1)/2));

%p m2:= floor(sqrt(10^d - 1));

%p S[d]:= {seq(i^2, i=m1..m2)};

%p if m1::even then m1:= m1+1 fi;

%p So[d]:= {seq(i^2, i=m1..m2,2)};

%p od:

%p for d from 2 to 9 do P[2,d]:= select(isprime, {seq(seq(seq(10^i*s+t, t=So[i]),s=S[d-i]),i=1..d-1)}) od:

%p L[2]:= 11:

%p mm[2]:= 2:

%p for m from 3 do

%p found:= false;

%p for d from mm[m-1]+1 to m+7 do

%p P[m,d]:= select(isprime, {seq(seq(seq(10^i*s+t, t=P[m-1,i]),s=S[d-i]),i=mm[m-1]..d-1)});

%p if P[m,d] <> {} and not found then mm[m]:= d; found:= true: L[m]:= min(P[m,d]) fi;

%p od;

%p if not found then break fi;

%p od:

%p seq(L[i],i=2..m-1);

%Y Cf. A167535, A364359.

%K nonn,base

%O 2,1

%A _Robert Israel_, Oct 20 2023