|
|
A004159
|
|
Sum of digits of n^2.
|
|
68
|
|
|
0, 1, 4, 9, 7, 7, 9, 13, 10, 9, 1, 4, 9, 16, 16, 9, 13, 19, 9, 10, 4, 9, 16, 16, 18, 13, 19, 18, 19, 13, 9, 16, 7, 18, 13, 10, 18, 19, 13, 9, 7, 16, 18, 22, 19, 9, 10, 13, 9, 7, 7, 9, 13, 19, 18, 10, 13, 18, 16, 16, 9, 13, 19, 27, 19, 13, 18, 25, 16, 18, 13, 10, 18, 19, 22, 18, 25, 25, 18, 13
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
a(10n) = a(n). If n > 1 is not a multiple of 10, then a(n)=4 iff n = 10^k+1 = A062397(k), a(n)=7 iff n is in A215614={4, 5, 32, 49, 149, 1049}, and else a(n) >= 9. - M. F. Hasler, Sep 23 2014
|
|
EXAMPLE
|
Trajectories under the map x -> a(x):
1 -> 1 -> 1 -> 1 -> 1 -> 1 -> 1 -> 1 -> 1 -> ...
2 -> 4 -> 7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> ...
3 -> 9 -> 9 -> 9 -> 9 -> 9 -> 9 -> 9 -> 9 -> ...
4 -> 7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> ...
5 -> 7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> ...
6 -> 9 -> 9 -> 9 -> 9 -> 9 -> 9 -> 9 -> 9 -> ...
7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> ...
|
|
MAPLE
|
read("transforms"):
digsum(n^2) ;
|
|
MATHEMATICA
|
a004159[n_Integer] := Apply[Plus, IntegerDigits[n^2]]; Table[
Total[IntegerDigits[#]]&/@(Range[0, 100]^2) (* Harvey P. Dale, Feb 03 2019 *)
|
|
PROG
|
(Haskell)
(Python)
return sum(int(d) for d in str(n*n)) # Chai Wah Wu, Sep 03 2014
|
|
CROSSREFS
|
Cf. A062685 (smallest square with digit sum n, or 0 if no such square exists).
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|