OFFSET
0,5
COMMENTS
a(n) mod 9 = 0 for all n.
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 0..9999
Christian N. K. Anderson, Ulam spiral of a(n) in red, with other multiples of 9 in gray.
EXAMPLE
a(0) = 0^2 - 0 = 0.
a(12) = 144 - (1+4+4) = 135.
MATHEMATICA
Table[n^2 - Sum[DigitCount[n^2][[i]]i, {i, 9}], {n, 50}] (* Alonso del Arte, Apr 21 2013 *)
#^2-Total[IntegerDigits[#^2]]&/@Range[0, 50] (* Harvey P. Dale, May 10 2017 *)
PROG
(R) library(gmp); digsum<-function(x) sum(as.numeric(unlist(strsplit(as.character(x), split=""))))
ans=rep(0, 100); n=0
while(n<=100) ans[(n=n+1)]=n^2-digsum(n^2); ans
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Kevin L. Schwartz and Christian N. K. Anderson, Apr 21 2013
STATUS
approved