A333034 a(n) is the sum of the digits of the squares of all n-digit numbers.
69, 1410, 21921, 298725, 3792660, 46016727, 541129686, 6221175405, 70311424443, 784112741880, 8651123311875, 94611219470547
Offset: 1
Examples
a(1) = 1+4+9+(1+6)+(2+5)+(3+6)+(4+9)+(6+4)+(8+1) = 69.
Crossrefs
Cf. A071317.
Programs
-
Maple
ds:= proc(x) local t,s,r; s:= x; t:= 0; while s > 0 do r:= s mod 10; t:= t + r; s:= (s-r)/10; od; t end proc: seq(add(ds(x^2),x=10^(n-1)..10^n-1), n=1..5);
-
PARI
for(d=0,6,print1(sum(k=10^d,10^(d+1)-1,vecsum(digits(k^2))),", ")) \\ Hugo Pfoertner, Mar 05 2020
-
Python
def A333034(n): return sum(int(d) for i in range(10**(n-1),10**n) for d in str(i**2)) # Chai Wah Wu, Mar 05 2020
Extensions
a(8)-a(9) from Hugo Pfoertner, Mar 05 2020
a(10)-a(12) from Giovanni Resta, Mar 07 2020
Comments