OFFSET
1,1
LINKS
James S. DeArmon, Table of n, a(n) for n = 1..999
James S. DeArmon, Common LISP code for A372629
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