|
|
A372629
|
|
Prime numbers whose sum of digits is a palindrome.
|
|
1
|
|
|
2, 3, 5, 7, 11, 13, 17, 23, 29, 31, 41, 43, 47, 53, 61, 71, 83, 101, 103, 107, 113, 131, 137, 151, 173, 191, 211, 223, 227, 233, 241, 251, 263, 281, 311, 313, 317, 331, 353, 401, 421, 431, 443, 461, 499, 503, 521, 601, 641, 701, 769, 787, 821, 859, 877, 911, 967, 1013, 1019, 1021, 1031, 1033, 1051
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
2411 is a term (prime, and digits sum to 8, a palindrome);
9931 is a term (prime, and digits sum to 22, a palindrome);
10099997 is a term (prime, and digits sum to 44).
|
|
PROG
|
(Python)
import sympy
def sum_of_digits(n):
return sum(int(digit) for digit in str(n))
def is_palindrome(n):
return str(n) == str(n)[::-1]
# Find prime numbers between 1 and 10000 whose sum of digits is a palindrome
prime_palindrome_numbers = []
for num in range(1, 10000):
if sympy.isprime(num):
digit_sum = sum_of_digits(num)
if is_palindrome(digit_sum):
prime_palindrome_numbers.append(num)
print(prime_palindrome_numbers)
(Common LISP -- see link)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,less
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|