OFFSET
1,2
COMMENTS
Each Niven number can be uniquely written as a(m)*10^z for some m > 0 and z >= 0.
This sequence contains numbers with k trailing zeros for any k >= 0; for example R(2^k) * 10^k (where R = A002275).
EXAMPLE
190 is a term as 190 is a Niven number and 19 is not a Niven number.
192 is a term as 192 is a Niven number and 192 is not divisible by 10.
PROG
(PARI) is(n, base=10) = my (s=sumdigits(n, base)); n%s==0 && (n%base || (n/base)%s)
(Python)
def ok(n):
sd = sum(map(int, str(n)))
return sd and not n%sd and (n%10 or (n//10)%sd)
print([k for k in range(235) if ok(k)]) # Michael S. Branicky, Oct 16 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Bernard Schott and Rémy Sigrist, Oct 15 2022
STATUS
approved