A375724 a(n) is the first Smith number with at least n digits.
4, 22, 121, 1086, 10086, 100066, 1000165, 10000426, 100000165, 1000000165, 10000000165, 100000000498, 1000000000066, 10000000000615, 100000000000786, 1000000000000426, 10000000000000246, 100000000000000642, 1000000000000000462, 10000000000000000246, 100000000000000000282, 1000000000000000000966
Offset: 1
Examples
a(5) = 10086 because 10086 has digit-sum 15 and 10086 = 2 * 3 * 41^2 with 2 + 3 + (4 + 1) + (4 + 1) = 15, and no k from 10000 to 10085 works.
Crossrefs
Cf. A006753.
Programs
-
Maple
f:= proc(n) local t,x; for x from 10^(n-1) do if isprime(x) then next fi; if convert(convert(x,base,10),`+`) = add(t[2]*convert(convert(t[1],base,10),`+`), t = ifactors(x)[2]) then return x fi; od end proc: map(f, [$1..30]);
-
Python
from sympy import factorint from itertools import count def sd(n): return sum(map(int, str(n))) def is_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 a(n): return next(k for k in count(10**(n-1)) if is_smith(k)) print([a(n) for n in range(1, 23)]) # Michael S. Branicky, Aug 25 2024
Comments