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.
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