cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A066591 Primes which can be expressed as a concatenation of nonnegative squares.

This page as a plain text file.
%I A066591 #25 Feb 20 2024 06:55:59
%S A066591 11,19,41,101,109,149,181,191,199,251,401,409,419,449,491,499,641,811,
%T A066591 911,919,941,991,1009,1019,1049,1091,1109,1181,1259,1289,1361,1409,
%U A066591 1481,1499,1601,1609,1619,1699,1811,1901,1949,1999,2251,2549,2591,3691
%N A066591 Primes which can be expressed as a concatenation of nonnegative squares.
%C A066591 All terms are == {1,9} mod 10. - _Zak Seidov_, Jul 16 2015
%C A066591 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 A066591 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 A066591 Chris K. Caldwell and G. L. Honaker, Jr., <a href="https://primes.utm.edu/curios/page.php?short=162536496481">1625364981</a>, Prime Curios!
%e A066591 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 A066591 N:= 10^4: # to get all terms <= N
%p A066591 catn:= proc(x,y) if y=0 then 10*x else x*10^(ilog10(y)+1)+y fi end proc:
%p A066591 Sq:= {seq(i^2,i=0..floor(sqrt(N)))}: Agenda:= Sq: S:= Sq:
%p A066591 while Agenda <> {} do
%p A066591 Agenda:= select(`<=`,{seq(seq(catn(f,g),f=Agenda),g=Sq)},N) minus S;
%p A066591 S:= S union Agenda;
%p A066591 od:
%p A066591 sort(convert(select(isprime,S),list)); # _Robert Israel_, Jul 16 2015
%o A066591 (Python)
%o A066591 from sympy import sieve
%o A066591 from itertools import count, islice
%o A066591 def iscat(w, A):
%o A066591     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 A066591 def agen():
%o A066591     S = {"0"}
%o A066591     for d in count(2):
%o A066591         S |= {str(i*i) for i in range(10**(d-2), 10**(d-1))}
%o A066591         for p in sieve.primerange(10**(d-1), 10**d):
%o A066591             if iscat(str(p), S):
%o A066591                 yield p
%o A066591 print(list(islice(agen(), 50))) # _Michael S. Branicky_, Feb 20 2024
%Y A066591 A061246 and A167535 are subsequences. - _Zak Seidov_, Jul 16 2015
%Y A066591 Cf. A000290, A068493.
%K A066591 base,easy,nonn
%O A066591 1,1
%A A066591 _Amarnath Murthy_, Dec 21 2001
%E A066591 Corrected and extended by Christopher Lund (clund(AT)san.rr.com), Apr 11 2002