login
Composite palindromes whose sum of prime factors is prime (counted with multiplicity).
3

%I #18 Jun 22 2021 11:35:34

%S 6,22,88,99,202,252,333,414,424,454,464,595,686,747,777,808,838,848,

%T 858,909,1001,1551,1771,2442,3553,4114,5335,5775,6336,6996,8008,8228,

%U 9009,9559,9669,9889,12121,14241,16261,16761,17171,18081,18381,20102,20602,21012

%N Composite palindromes whose sum of prime factors is prime (counted with multiplicity).

%H Michael S. Branicky, <a href="/A046365/b046365.txt">Table of n, a(n) for n = 1..10000</a>

%F A046363 INTERSECT A002113. - _R. J. Mathar_, Sep 09 2015

%t Select[Range[20125], !PrimeQ[#] && Reverse[x=IntegerDigits[#]] == x && PrimeQ[Total[Times@@@FactorInteger[#]]]&] (* _Jayanta Basu_, May 29 2013 *)

%o (Python)

%o from itertools import product

%o from sympy import factorint, isprime

%o def pals(d, base=10): # all d-digit palindromes

%o digits = "".join(str(i) for i in range(base))

%o for p in product(digits, repeat=d//2):

%o if d > 1 and p[0] == "0": continue

%o left = "".join(p); right = left[::-1]

%o for mid in [[""], digits][d%2]: yield int(left + mid + right)

%o def ok(pal):

%o f = factorint(pal); return len(f)>1 and isprime(sum(p*f[p] for p in f))

%o print(list(filter(ok, (p for d in range(1, 6) for p in pals(d) if ok(p))))) # _Michael S. Branicky_, Jun 22 2021

%Y Cf. A046363, A046364.

%K nonn,base

%O 1,1

%A _Patrick De Geest_, Jun 15 1998

%E a(45) and beyond from _Michael S. Branicky_, Jun 22 2021