OFFSET
1,1
LINKS
Donovan Johnson, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 121 because 121 is a Smith number as well as a palindromic number.
MATHEMATICA
d[n_] := IntegerDigits[n]; tr[n_] := Transpose[FactorInteger[n]]; Select[Range[2, 1.7*10^5], !PrimeQ[#] && Reverse[x=d[#]] == x && Total[x] == Total[d@tr[#][[1]]*tr[#][[2]], 2]&] (* Jayanta Basu, Jun 04 2013 *)
PROG
(Python)
from sympy import factorint
from itertools import product
def sd(n): return sum(map(int, str(n)))
def smith(n):
f = factorint(n)
return sum(f[p] for p in f) > 1 and sd(n) == sum(sd(p)*f[p] for p in f)
def palsto(limit):
yield from range(min(limit, 9)+1)
midrange = [[""], [str(i) for i in range(10)]]
for digs in range(2, 10**len(str(limit))):
for p in product("0123456789", repeat=digs//2):
left = "".join(p)
if left[0] == '0': continue
for middle in midrange[digs%2]:
out = int(left + middle + left[::-1])
if out > limit: return
yield out
print(list(filter(smith, palsto(164461)))) # Michael S. Branicky, Apr 22 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Shyam Sunder Gupta, Oct 10 2004
STATUS
approved