|
|
A050220
|
|
Larger of Smith brothers.
|
|
4
|
|
|
729, 2965, 3865, 4960, 5936, 6188, 9387, 9634, 11696, 13765, 16537, 16592, 20785, 25429, 28809, 29624, 32697, 33633, 35806, 39586, 43737, 44734, 49028, 55345, 56337, 57664, 58306, 62635, 65913, 65975, 66651, 67068, 67729, 69280, 69836, 73616, 73617, 74169
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
MAPLE
|
issmith:= proc(n)
if isprime(n) then return false fi;
convert(convert(n, base, 10), `+`) = add(t[2]*convert(convert(t[1], base, 10), `+`), t=ifactors(n)[2])
end proc:
S:= select(issmith, {$4..10^5}):
sort(convert(S intersect map(`+`, S, 1), list)); # Robert Israel, Jan 15 2018
|
|
MATHEMATICA
|
smithQ[n_] := n > 1 && !PrimeQ[n] && Total[Flatten[IntegerDigits[Table[#[[1]], {#[[2]]}]& /@ FactorInteger[n]]]] == Total[IntegerDigits[n]];
|
|
PROG
|
(PARI) isone(n) = {if (!isprime(n), f = factor(n); sumdigits(n) == sum(k=1, #f~, f[k, 2]*sumdigits(f[k, 1])); ); }
(Python)
from sympy import factorint
from itertools import count, islice
def sd(n): return sum(map(int, str(n)))
def smith():
for k in count(1):
f = factorint(k)
if sum(f[p] for p in f) > 1 and sd(k) == sum(sd(p)*f[p] for p in f):
yield k
def agen():
prev = -1
for s in smith():
if s == prev + 1: yield s
prev = s
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|