login
A357769
Positive numbers with decimal expansion d_1, ..., d_w that are divisible by d_1 + ... + d_k for k = 1..w.
1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 24, 30, 36, 40, 48, 50, 60, 70, 80, 90, 100, 102, 108, 110, 112, 114, 120, 126, 132, 140, 150, 156, 180, 190, 200, 204, 210, 216, 220, 224, 228, 230, 240, 252, 264, 270, 280, 300, 306, 312, 330, 336, 360, 396, 400
OFFSET
1,2
COMMENTS
Leading zeros are ignored (d_1 > 0).
In other words, this sequence corresponds to numbers that are divisible by the sum of digits of all their prefixes.
All terms belong to A005349 (Niven numbers), A034837 and to A328273.
If t is a term, then 10*t is also a term (see A356350 for the primitive terms).
Contains no odd terms > 9. Else, d_1 and all d_1 + ... + d_k for k = 2..w-1 would have to be odd, but then d_1 + ... + d_w would be even. - Michael S. Branicky, Oct 15 2022
EXAMPLE
180 is a term as it is divisible by 1, 1+8 and 1+8+0.
111 is not a term as it is divisible by 1 and 1+1+1 but not by 1+1.
MATHEMATICA
Select[Range@400, And @@ IntegerQ /@ (#/Accumulate@ IntegerDigits@ #) &] (* Giovanni Resta, Oct 15 2022 *)
PROG
(PARI) is(n, base=10) = { my (d=digits(n, base), s=0); for (k=1, #d, if (n % (s+=d[k]), return (0)); ); return (1); }
(Python)
def ok(n):
s = str(n); sk = int(s[0])
for k in range(len(s)-1):
if n%sk != 0: return False
sk += int(s[k+1])
return n%sk == 0
print([k for k in range(1, 401) if ok(k)]) # Michael S. Branicky, Oct 12 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Oct 12 2022
STATUS
approved