A385640 Numbers k such that the sum of the digits of k divides k and the sum of the digits of k^2 divides k^2.
1, 2, 3, 6, 9, 10, 12, 18, 20, 21, 24, 30, 36, 42, 45, 48, 54, 60, 63, 72, 80, 84, 90, 100, 102, 108, 110, 111, 112, 117, 120, 126, 132, 140, 144, 150, 156, 162, 180, 190, 198, 200, 201, 204, 207, 210, 216, 220, 234, 240, 243, 252, 264, 270, 288, 300, 306, 315
Offset: 1
Examples
18 is a term since 1+8 = 9 and 18 mod 9 = 0; also, 18^2 = 324, and 3+2+4 = 9 and 324 mod 9 = 0.
Links
- Vighnesh Patil, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
A385640Q[k_] := Divisible[k, DigitSum[k]] && Divisible[k^2, DigitSum[k^2]]; Select[Range[500], A385640Q] (* Paolo Xausa, Jul 06 2025 *)
-
Python
def digit_sum(n): return sum(int(d) for d in str(n)) def ok(n): return n % digit_sum(n) == 0 and (n**2) % digit_sum(n**2) == 0 print([n for n in range(1, 400) if ok(n)])
Comments