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”).
%I #18 May 31 2024 13:58:33
%S 2,3,5,7,11,13,17,23,29,31,41,43,47,53,61,71,83,101,103,107,113,131,
%T 137,151,173,191,211,223,227,233,241,251,263,281,311,313,317,331,353,
%U 401,421,431,443,461,499,503,521,601,641,701,769,787,821,859,877,911,967,1013,1019,1021,1031,1033,1051
%N Prime numbers whose sum of digits is a palindrome.
%H James S. DeArmon, <a href="/A372629/b372629.txt">Table of n, a(n) for n = 1..999</a>
%H James S. DeArmon, <a href="/A372629/a372629.txt">Common LISP code for A372629</a>
%e 2411 is a term (prime, and digits sum to 8, a palindrome);
%e 9931 is a term (prime, and digits sum to 22, a palindrome);
%e 10099997 is a term (prime, and digits sum to 44).
%o (Python)
%o import sympy
%o def sum_of_digits(n):
%o return sum(int(digit) for digit in str(n))
%o def is_palindrome(n):
%o return str(n) == str(n)[::-1]
%o # Find prime numbers between 1 and 10000 whose sum of digits is a palindrome
%o prime_palindrome_numbers = []
%o for num in range(1,10000):
%o if sympy.isprime(num):
%o digit_sum = sum_of_digits(num)
%o if is_palindrome(digit_sum):
%o prime_palindrome_numbers.append(num)
%o print(prime_palindrome_numbers)
%o (Common LISP -- see link)
%Y Cf. A002385, A007500, A033620
%K nonn,base,less
%O 1,1
%A _James S. DeArmon_, May 07 2024