Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #25 Feb 20 2024 06:55:59
%S 11,19,41,101,109,149,181,191,199,251,401,409,419,449,491,499,641,811,
%T 911,919,941,991,1009,1019,1049,1091,1109,1181,1259,1289,1361,1409,
%U 1481,1499,1601,1609,1619,1699,1811,1901,1949,1999,2251,2549,2591,3691
%N Primes which can be expressed as a concatenation of nonnegative squares.
%C All terms are == {1,9} mod 10. - _Zak Seidov_, Jul 16 2015
%C The surprising prime 162536496481 is the concatenation of the 6 double-digit squares in increasing order (see Prime Curios! link). - _Bernard Schott_, Nov 19 2020
%H Michael S. Branicky, <a href="/A066591/b066591.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..2103 from Robert Israel)
%H Chris K. Caldwell and G. L. Honaker, Jr., <a href="https://primes.utm.edu/curios/page.php?short=162536496481">1625364981</a>, Prime Curios!
%e 96181 is a term as it is a concatenation of 961 and 81 both of which are squares. 100169 is a term as it is a concatenation of 100 and 169 in one way and also that of 1, 0, 0, 16 and 9 in another way.
%p N:= 10^4: # to get all terms <= N
%p catn:= proc(x,y) if y=0 then 10*x else x*10^(ilog10(y)+1)+y fi end proc:
%p Sq:= {seq(i^2,i=0..floor(sqrt(N)))}: Agenda:= Sq: S:= Sq:
%p while Agenda <> {} do
%p Agenda:= select(`<=`,{seq(seq(catn(f,g),f=Agenda),g=Sq)},N) minus S;
%p S:= S union Agenda;
%p od:
%p sort(convert(select(isprime,S),list)); # _Robert Israel_, Jul 16 2015
%o (Python)
%o from sympy import sieve
%o from itertools import count, islice
%o def iscat(w, A):
%o return False if len(w) < 2 else any(w[:i] in A and (w[i:] in A or iscat(w[i:], A)) for i in range(1, len(w)))
%o def agen():
%o S = {"0"}
%o for d in count(2):
%o S |= {str(i*i) for i in range(10**(d-2), 10**(d-1))}
%o for p in sieve.primerange(10**(d-1), 10**d):
%o if iscat(str(p), S):
%o yield p
%o print(list(islice(agen(), 50))) # _Michael S. Branicky_, Feb 20 2024
%Y A061246 and A167535 are subsequences. - _Zak Seidov_, Jul 16 2015
%Y Cf. A000290, A068493.
%K base,easy,nonn
%O 1,1
%A _Amarnath Murthy_, Dec 21 2001
%E Corrected and extended by Christopher Lund (clund(AT)san.rr.com), Apr 11 2002