OFFSET
1,1
COMMENTS
McDaniel (1990) proved that there exist infinitely many numbers which are both base-b Niven numbers and base-b Smith numbers, for all bases b >= 8.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
Wayne L. McDaniel, On the Intersection of the Sets of Base b Smith Numbers and Niven Numbers, Missouri Journal of Mathematical Sciences, Vol. 2, No. 3 (1990), pp. 132-136.
EXAMPLE
27 is a term since it is a Niven number (2 + 7 = 9 is a divisor of 27) and a Smith number (27 = 3 * 3 * 3 and 2 + 7 = 3 + 3 + 3).
MATHEMATICA
digSum[n_] := Plus @@ IntegerDigits[n]; nivenSmithQ[n_] := Divisible[n, (ds = digSum[n])] && CompositeQ[n] && Plus @@ (Last@# * digSum[First@#] & /@ FactorInteger[n]) == ds; Select[Range[10^4], nivenSmithQ]
PROG
(Python)
from sympy import factorint
def sd(n): return sum(map(int, str(n)))
def ok(n):
sdn = sd(n)
if sdn == 0 or n%sdn != 0: return False # not Niven
f = factorint(n)
return sum(f[p] for p in f) > 1 and sdn == sum(sd(p)*f[p] for p in f)
print(list(filter(ok, range(9999)))) # Michael S. Branicky, Apr 27 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amiram Eldar, May 05 2020
STATUS
approved