login
A050219
Smaller of Smith brothers.
8
728, 2964, 3864, 4959, 5935, 6187, 9386, 9633, 11695, 13764, 16536, 16591, 20784, 25428, 28808, 29623, 32696, 33632, 35805, 39585, 43736, 44733, 49027, 55344, 56336, 57663, 58305, 62634, 65912, 65974, 66650, 67067, 67728, 69279, 69835, 73615, 73616, 74168
OFFSET
1,1
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Robert Israel)
Eric Weisstein's World of Mathematics, Smith Brothers.
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_] := !PrimeQ[n] && Total[Flatten[IntegerDigits[Table[#[[1]], {#[[2]]}]& /@ FactorInteger[n]]]] == Total[IntegerDigits[n]];
Select[Range[10^5], smithQ[#] && smithQ[#+1]&] (* Jean-François Alcover, Jun 07 2020 *)
PROG
(PARI) isone(n) = {if (!isprime(n), f = factor(n); sumdigits(n) == sum(k=1, #f~, f[k, 2]*sumdigits(f[k, 1])); ); }
isok(n) = isone(n) && isone(n+1); \\ Michel Marcus, Jul 17 2015
(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 prev
prev = s
print(list(islice(agen(), 38))) # Michael S. Branicky, Dec 23 2022
CROSSREFS
Sequence in context: A158395 A184077 A234652 * A051383 A293650 A233962
KEYWORD
nonn,base
EXTENSIONS
Offset corrected by Arkadiusz Wesolowski, May 08 2012
STATUS
approved