login
Primitive numbers n such that the sums of the digits of n and n^2 coincide.
6

%I #26 Sep 08 2022 08:46:11

%S 1,9,18,19,45,46,55,99,145,189,198,199,289,351,361,369,379,388,451,

%T 459,468,495,496,558,559,568,585,595,639,729,739,775,838,855,954,955,

%U 999,1098,1099,1179,1188,1189,1198,1269,1468,1485,1494,1495,1585,1738,1747

%N Primitive numbers n such that the sums of the digits of n and n^2 coincide.

%C Members of A058369 not congruent to 0 (mod 10).

%C This sequence is to A058369 what A114135 is to A111434.

%C 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

%H Nikhil Mahajan, <a href="/A254066/b254066.txt">Table of n, a(n) for n = 1..10000</a>

%H K. G. Hare, S. Laishram, and T. Stoll, <a href="http://arxiv.org/abs/1001.4170">The sum of digits of n and n^2</a>, International Journal of Number Theory 7:7 (2011), pp. 1737-1752.

%e 9 is in the sequence because the digit sum of 9^2 = 81 is 9.

%e 18 is in the sequence because the digit sum of 18^2 = 324 is 9, same as the digit sum of 18.

%t Select[Range[1000],!Divisible[#,10]&&Total[IntegerDigits[#]] == Total[ IntegerDigits[#^2]]&] (* _Harvey P. Dale_, Dec 27 2015 *)

%o (Sage) [n for n in [0..1000] if sum(n.digits())==sum((n^2).digits()) and n%10!=0] # _Tom Edgar_, Jan 27 2015

%o (Magma) [n: n in [1..1000] | &+Intseq(n) eq &+Intseq(n^2) and not IsZero(n mod 10)]; // _Bruno Berselli_, Jan 29 2015

%o (PARI) is(n)=sumdigits(n)==sumdigits(n^2) \\ _Charles R Greathouse IV_, Aug 25 2015

%o (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

%Y Cf. A058369, A114135, A111434.

%Y Subsequence of A090570.

%K nonn,base

%O 1,2

%A _Nikhil Mahajan_, Jan 25 2015

%E More terms from _Harvey P. Dale_, Dec 27 2015