A357769 Positive numbers with decimal expansion d_1, ..., d_w that are divisible by d_1 + ... + d_k for k = 1..w.
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
Examples
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.
Programs
-
Mathematica
Select[Range@400, And @@ IntegerQ /@ (#/Accumulate@ IntegerDigits@ #) &] (* Giovanni Resta, Oct 15 2022 *)
-
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
Comments