OFFSET
1,2
COMMENTS
Members of A058369 not congruent to 0 (mod 10).
Hare, Laishram, & Stoll show that this sequence is infinite. In particular for each k in {846, 847, 855, 856, 864, 865, 873, ...} there are infinitely many terms in this sequence with digit sum k. - Charles R Greathouse IV, Aug 25 2015
LINKS
Nikhil Mahajan, Table of n, a(n) for n = 1..10000
K. G. Hare, S. Laishram, and T. Stoll, The sum of digits of n and n^2, International Journal of Number Theory 7:7 (2011), pp. 1737-1752.
EXAMPLE
9 is in the sequence because the digit sum of 9^2 = 81 is 9.
18 is in the sequence because the digit sum of 18^2 = 324 is 9, same as the digit sum of 18.
MATHEMATICA
Select[Range[1000], !Divisible[#, 10]&&Total[IntegerDigits[#]] == Total[ IntegerDigits[#^2]]&] (* Harvey P. Dale, Dec 27 2015 *)
PROG
(Sage) [n for n in [0..1000] if sum(n.digits())==sum((n^2).digits()) and n%10!=0] # Tom Edgar, Jan 27 2015
(Magma) [n: n in [1..1000] | &+Intseq(n) eq &+Intseq(n^2) and not IsZero(n mod 10)]; // Bruno Berselli, Jan 29 2015
(PARI) is(n)=sumdigits(n)==sumdigits(n^2) \\ Charles R Greathouse IV, Aug 25 2015
(PARI) list(lim)=my(v=List()); forstep(n=1, lim, [8, 9, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9], if(sumdigits(n)==sumdigits(n^2), listput(v, n))); Vec(v) \\ Charles R Greathouse IV, Aug 26 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Nikhil Mahajan, Jan 25 2015
EXTENSIONS
More terms from Harvey P. Dale, Dec 27 2015
STATUS
approved