login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A052035 Palindromic primes whose sum of squared digits is also prime. 3
11, 101, 131, 191, 313, 353, 373, 797, 919, 10301, 11311, 12721, 13331, 13931, 14341, 14741, 16361, 17971, 18181, 19391, 30103, 30703, 33533, 71317, 71917, 74747, 75557, 76367, 77977, 79397, 90709, 93139, 93739, 95959, 96769, 97379 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
From Bernard Schott, Oct 20 2021: (Start)
Except for 11, all terms have an odd number of digits.
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)
REFERENCES
Charles W. Trigg, Journal of Recreational Mathematics, Vol. 20(2), 1988.
LINKS
Mike Mudge, Morph code, Hands On Numbers Count, Personal Computer World, May 1997, p. 290.
EXAMPLE
373 -> 3^2 + 7^2 + 3^2 = 67, which is prime.
MATHEMATICA
Select[Prime@ Range[2, 10^4], And[PalindromeQ@ #, PrimeQ@ Total[IntegerDigits[#]^2]] &] (* Michael De Vlieger, Oct 20 2021 *)
PROG
(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
(Python)
from sympy import isprime
def ok(n):
s = str(n)
return s==s[::-1] and isprime(n) and isprime(sum(int(d)**2 for d in s))
print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Nov 23 2021
(Python) # second version for going to large terms
from sympy import isprime
from itertools import product
def ok(pal):
return isprime(pal) and isprime(sum(int(d)**2 for d in str(pal)))
def agentod(maxdigs):
yield 11
for d in range(3, maxdigs+1, 2):
pal = 10**(d-1) + 1
if ok(pal): yield pal
for first in "1379":
for left in product("0123456789", repeat=(d-3)//2):
left = "".join(left)
for mid in "13579":
pal = int(first + left + mid + left[::-1] + first)
if ok(pal): yield pal
print([an for an in agentod(5)]) # Michael S. Branicky, Nov 23 2021
CROSSREFS
Sequence in context: A088281 A068685 A109830 * A083144 A058411 A134462
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Dec 15 1999
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 09:23 EDT 2024. Contains 371967 sequences. (Running on oeis4.)