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.
%I A052035 #39 Nov 23 2021 15:58:54 %S A052035 11,101,131,191,313,353,373,797,919,10301,11311,12721,13331,13931, %T A052035 14341,14741,16361,17971,18181,19391,30103,30703,33533,71317,71917, %U A052035 74747,75557,76367,77977,79397,90709,93139,93739,95959,96769,97379 %N A052035 Palindromic primes whose sum of squared digits is also prime. %C A052035 From _Bernard Schott_, Oct 20 2021: (Start) %C A052035 Except for 11, all terms have an odd number of digits. %C A052035 Except for terms of the form 10^k+1, k >= 2, the middle digit is always odd; the unique known term of the form 10^k+1 for 2 <= k <= 100000 is 101 (see comment in A000533). (End) %D A052035 Charles W. Trigg, Journal of Recreational Mathematics, Vol. 20(2), 1988. %H A052035 Michel Marcus, <a href="/A052035/b052035.txt">Table of n, a(n) for n = 1..1215</a> %H A052035 Mike Mudge, <a href="https://archive.org/details/PersonalComputerWorldMagazine/PCW%20199705%20May%20Created%20From%20PCW%20Cover%20CD/page/n121/mode/1up?view=theater">Morph code</a>, Hands On Numbers Count, Personal Computer World, May 1997, p. 290. %e A052035 373 -> 3^2 + 7^2 + 3^2 = 67, which is prime. %t A052035 Select[Prime@ Range[2, 10^4], And[PalindromeQ@ #, PrimeQ@ Total[IntegerDigits[#]^2]] &] (* _Michael De Vlieger_, Oct 20 2021 *) %o A052035 (PARI) isok(p) = my(d=digits(p)); isprime(p) && (d==Vecrev(d)) && isprime(sum(k=1, #d, d[k]^2)); \\ _Michel Marcus_, Oct 17 2021 %o A052035 (Python) %o A052035 from sympy import isprime %o A052035 def ok(n): %o A052035 s = str(n) %o A052035 return s==s[::-1] and isprime(n) and isprime(sum(int(d)**2 for d in s)) %o A052035 print([k for k in range(10**5) if ok(k)]) # _Michael S. Branicky_, Nov 23 2021 %o A052035 (Python) # second version for going to large terms %o A052035 from sympy import isprime %o A052035 from itertools import product %o A052035 def ok(pal): %o A052035 return isprime(pal) and isprime(sum(int(d)**2 for d in str(pal))) %o A052035 def agentod(maxdigs): %o A052035 yield 11 %o A052035 for d in range(3, maxdigs+1, 2): %o A052035 pal = 10**(d-1) + 1 %o A052035 if ok(pal): yield pal %o A052035 for first in "1379": %o A052035 for left in product("0123456789", repeat=(d-3)//2): %o A052035 left = "".join(left) %o A052035 for mid in "13579": %o A052035 pal = int(first + left + mid + left[::-1] + first) %o A052035 if ok(pal): yield pal %o A052035 print([an for an in agentod(5)]) # _Michael S. Branicky_, Nov 23 2021 %Y A052035 Cf. A000533, A002385, A052034, A003132. %K A052035 nonn,base %O A052035 1,1 %A A052035 _Patrick De Geest_, Dec 15 1999