A348300
a(n) is the largest number that is the digit sum of the square of an n-digit number.
Original entry on oeis.org
13, 31, 46, 63, 81, 97, 112, 130, 148, 162, 180, 193, 211, 229, 244, 262, 277, 297, 310, 331, 343, 360, 378, 396
Offset: 1
a(3) = 46 because 46 is the largest digital sum encountered among the squares (that of 937) of all 3-digit numbers. Such maximal digital sum can be achieved by more than one square (squares of 836 and 883 also have digital sum 46). Largest of these is A348303.
-
Array[Max@ Map[Total@ IntegerDigits[#^2] &, Range[10^(# - 1), 10^# - 1]] &, 8] (* Michael De Vlieger, Oct 12 2021 *)
-
def A348300(n): return max(sum(int(d) for d in str(m**2)) for m in range(10**(n-1),10**n)) # Chai Wah Wu, Jun 26 2024
-
def A348300(n):
return max(sum((k^2).digits()) for k in (10^(n-1)..10^n-1))
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)).
Original entry on oeis.org
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
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.
-
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}]
A370522
a(n) is the least n-digit number whose square has the maximum sum of digits (A348300(n)).
Original entry on oeis.org
7, 83, 836, 8937, 94863, 987917, 9893887, 99477133, 994927133, 9380293167, 99497231067, 926174913167, 9892825177313, 89324067192437, 943291047332683, 9949874270443813, 83066231922477313, 707106074079263583, 9429681807356492126, 94180040294109027313, 888142995231510436417, 8882505274864168010583
Offset: 1
a(3) = 836 because among all 3-digit numbers, 836 is the smallest whose square 698896 has the maximum sum of digits, 46 = A348300(3).
-
A348300={13,31,46,63,81,97,112,130,148,162,180};
A370522[n_]:=Do[If[Total@IntegerDigits[k^2]==A348300[[n]],Return[k];],{k,10^(n-1),10^n-1}];
Table[A370522[n],{n,8}]
-
def A370522(n):
A348300=[0,13,31,46,63,81,97,112,130,148,162,180]
for k in range(10**(n-1), 10**n):
if sum(int(d) for d in str(k**2))==A348300[n]:
return(k)
print([A370522(n) for n in range(1,9)])
Showing 1-3 of 3 results.
Comments