%I #41 Apr 30 2023 17:18:48
%S 0,1,10,35,100,152,350,377,452,539,709,1000,1299,1398,1439,1519,1520,
%T 1569,1591,1679,1965,2599,2838,3332,3500,3598,3770,4520,4586,4754,
%U 4854,5390,5501,5835,5857,6388,6595,6735,6861,6951,7090,7349,7887,8395,9795,10000,10056,10159,10389,11055,11091,12990,12999
%N Numbers k such that A003132(k^2) = A003132(k), where A003132(n) is the sum of the squares of the digits of n.
%C If k is in the sequence, then so are k*10^r, r >= 1.
%H Robert Israel, <a href="/A309883/b309883.txt">Table of n, a(n) for n = 1..10000</a>
%e 377^2 = 142129, A003132(377) = 3^2 + 7^2 + 7^2 = 107, A003132(142129) = 1^2 + 4^2 + 2^2 + 1^2 + 2^2 + 9^2 = 107.
%p filter:= proc(n) local t;
%p add(t^2, t = convert(n,base,10)) = add(t^2, t = convert(n^2,base,10))
%p end proc:
%p select(filter, [$0..20000]); # _Robert Israel_, Apr 30 2023
%t digSum[n_] := Total[IntegerDigits[n]^2]; Select[Range[0, 13000], digSum[#] == digSum[#^2] &] (* _Amiram Eldar_, Aug 22 2019 *)
%o (PARI) for(i = 0, 30000, if(norml2(digits(i^2)) == norml2(digits(i)), print1(i, ", ")))
%o (Python)
%o def A003132(n):
%o s = 0
%o while n > 0:
%o s, n = s+(n%10)**2, n//10
%o return s
%o n, a = 0, 0
%o while n < 50:
%o if A003132(a) == A003132(a*a):
%o n = n+1
%o print(n,a)
%o a = a+1 # _A.H.M. Smeets_, Aug 23 2019
%o (Magma) [0] cat [k:k in [1..13000]| &+[c^2: c in Intseq(k)] eq &+[c^2: c in Intseq(k^2)]]; // _Marius A. Burtea_, Aug 24 2019
%Y Cf. A003132, A058369, A070276, A174460, A176670, A178213, A307735, A309884.
%K nonn,base
%O 1,3
%A _Antonio Roldán_, Aug 21 2019
|