OFFSET
1,1
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..10000 (first 2000 terms from Zak Seidov, terms a(2001)-a(2816) from Michael De Vlieger)
EXAMPLE
111 is a palindrome and 111 = 3*37. 3 and 37 are primes.
MATHEMATICA
fQ[n_] := Block[{id = IntegerDigits[n]}, Plus @@ Last /@ FactorInteger[n] == 2 && id == Reverse[id]]; Select[ Range[ 10000], fQ[ # ] &] (* Robert G. Wilson v, Jun 06 2005 *)
Select[Range[10002], Reverse[x = IntegerDigits[#]] == x && PrimeOmega[#] == 2 &] (* Jayanta Basu, Jun 23 2013 *)
Select[Range[11000], PalindromeQ[#]&&PrimeOmega[#]==2&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 30 2018 *)
PROG
(PARI) ispal(n) = my(d=digits(n)); d == Vecrev(d) \\ A002113
for(k=1, 1e4, if(ispal(k)&&bigomega(k)==2, print1(k, ", "))) \\ Alexandru Petrescu, Jul 07 2022
(Python)
from sympy import factorint
from itertools import product
def ispal(n): s = str(n); return s == s[::-1]
def pals(d, base=10): # all d-digit palindromes
digits = "".join(str(i) for i in range(base))
for p in product(digits, repeat=d//2):
if d > 1 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], digits][d%2]: yield int(left + mid + right)
def ok(pal): return sum(factorint(pal).values()) == 2
print(list(filter(ok, (p for d in range(1, 6) for p in pals(d) if ok(p))))) # Michael S. Branicky, Aug 14 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Jun 15 1998
STATUS
approved