cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A385640 #21 Jul 09 2025 10:13:31
%S A385640 1,2,3,6,9,10,12,18,20,21,24,30,36,42,45,48,54,60,63,72,80,84,90,100,
%T A385640 102,108,110,111,112,117,120,126,132,140,144,150,156,162,180,190,198,
%U A385640 200,201,204,207,210,216,220,234,240,243,252,264,270,288,300,306,315
%N 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.
%C A385640 If k is in the sequence then so is 10*k. - _David A. Corneth_, Jul 06 2025
%H A385640 Vighnesh Patil, <a href="/A385640/b385640.txt">Table of n, a(n) for n = 1..1000</a>
%F A385640 A005349(a(n)) | a(n) and A005349(a(n)^2) | a(n)^2.
%F A385640 {k | k in A005349 and k^2 in A005349}. - _Michael S. Branicky_, Jul 05 2025
%e A385640 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.
%t A385640 A385640Q[k_] :=  Divisible[k, DigitSum[k]] && Divisible[k^2, DigitSum[k^2]];
%t A385640 Select[Range[500], A385640Q] (* _Paolo Xausa_, Jul 06 2025 *)
%o A385640 (Python)
%o A385640 def digit_sum(n): return sum(int(d) for d in str(n))
%o A385640 def ok(n):
%o A385640     return n % digit_sum(n) == 0 and (n**2) % digit_sum(n**2) == 0
%o A385640 print([n for n in range(1, 400) if ok(n)])
%Y A385640 Intersection of A005349 and A385656.
%Y A385640 Cf. A007953.
%K A385640 nonn,base,easy
%O A385640 1,2
%A A385640 _Vighnesh Patil_, Jul 05 2025