login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
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
James S. DeArmon, May 07 2024
STATUS
approved