A379298 Largest number k for which k^2 is n digits long and has the maximum sum of digits possible for such a square (A371728(n)).
3, 7, 28, 83, 313, 937, 3114, 9417, 29614, 94863, 298327, 987917, 3162083, 9893887, 29983327, 99483667, 315432874, 994927133, 2999833327, 9486778167, 31464263856, 99497231067, 299998333327, 999949483667, 3160522105583, 9892825177313, 29999983333327
Offset: 1
Examples
a(6) = 937 because among all 6-digit squares, 698896 = 836^2, 779689 = 883^2, 877969 = 937^2 have the maximum sum of digits 46 = A371728(6), and 937 is the largest.
Programs
-
Mathematica
a[n_] := Module[{s = Floor[Sqrt[(10^n - 1)]], max = 0}, For[k = s, k >= Ceiling[Sqrt[10^(n - 1)]], k--, t = DigitSum[k^2]; If[t > max, s = k; max = t]]; s]; Table[a[n], {n, 30}]
Formula
Conjecture: a(2*n) = A348303(n).