cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-6 of 6 results.

A004159 Sum of digits of n^2.

Original entry on oeis.org

0, 1, 4, 9, 7, 7, 9, 13, 10, 9, 1, 4, 9, 16, 16, 9, 13, 19, 9, 10, 4, 9, 16, 16, 18, 13, 19, 18, 19, 13, 9, 16, 7, 18, 13, 10, 18, 19, 13, 9, 7, 16, 18, 22, 19, 9, 10, 13, 9, 7, 7, 9, 13, 19, 18, 10, 13, 18, 16, 16, 9, 13, 19, 27, 19, 13, 18, 25, 16, 18, 13, 10, 18, 19, 22, 18, 25, 25, 18, 13
Offset: 0

Views

Author

Keywords

Comments

If 3|n then 9|a(n); otherwise, a(n) == 1 (mod 3). - Jon E. Schoenfield, Jun 30 2018

Examples

			Trajectories under the map x -> a(x):
1 ->  1 ->  1 ->  1 ->  1 ->  1 ->  1 ->  1 ->  1 -> ...
2 ->  4 ->  7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> ...
3 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 -> ...
4 ->  7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> ...
5 ->  7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> ...
6 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 ->  9 -> ...
7 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> 13 -> 16 -> ...
- _R. J. Mathar_, Jul 08 2012
		

Crossrefs

Cf. A240752 (first differences), A071317 (partial sums).
Cf. A062685 (smallest square with digit sum n, or 0 if no such square exists).

Programs

  • Haskell
    a004159 = a007953 . a000290  -- Reinhard Zumkeller, Apr 12 2014
    
  • Maple
    read("transforms"):
    A004159 := proc(n)
            digsum(n^2) ;
    end proc: # R. J. Mathar, Jul 08 2012
  • Mathematica
    a004159[n_Integer] := Apply[Plus, IntegerDigits[n^2]]; Table[
    a004159[n], {n, 0, 100}] (* Michael De Vlieger, Jul 21 2014 *)
    Total[IntegerDigits[#]]&/@(Range[0,100]^2) (* Harvey P. Dale, Feb 03 2019 *)
  • PARI
    A004159(n)=sumdigits(n^2) \\ M. F. Hasler, Sep 23 2014
  • Python
    def A004159(n):
        return sum(int(d) for d in str(n*n)) # Chai Wah Wu, Sep 03 2014
    

Formula

a(n) = A007953(A000290(n)); a(A058369(n)) = A007953(A058369(n)). - Reinhard Zumkeller, Apr 25 2009
a(10n) = a(n). If n > 1 is not a multiple of 10, then a(n)=4 iff n = 10^k+1 = A062397(k), a(n)=7 iff n is in A215614={4, 5, 32, 49, 149, 1049}, and else a(n) >= 9. - M. F. Hasler, Sep 23 2014

A353974 a(n) is the n-th partial sum of A056992.

Original entry on oeis.org

0, 1, 5, 14, 21, 28, 37, 41, 42, 51, 52, 56, 65, 72, 79, 88, 92, 93, 102, 103, 107, 116, 123, 130, 139, 143, 144, 153, 154, 158, 167, 174, 181, 190, 194, 195, 204, 205, 209, 218, 225, 232, 241, 245, 246, 255, 256, 260, 269, 276, 283, 292, 296, 297, 306, 307, 311
Offset: 0

Views

Author

Stefano Spezia, May 12 2022

Keywords

Comments

Also the n-th partial sum of the main diagonal of A353109, or equivalently, the trace of the matrix M(n) whose permanent is A353933(n) for n > 0.

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[x(1+4x+9x^2+7x^3+7x^4+9x^5+4x^6+x^7+9x^8)/((1-x)^2(1+x+x^2)(1+x^3+x^6)),{x,0,56}],x]

Formula

G.f.: x*(1 + 4*x + 9*x^2 + 7*x^3 + 7*x^4 + 9*x^5 + 4*x^6 + x^7 + 9*x^8)/((1 - x)^2*(1 + x + x^2)*(1 + x^3 + x^6)).
a(n) = a(n-1) + a(n-9) - a(n-10) for n > 9.
a(n) ~ 51*n/9.

A071121 a(n) = a(n-1) + sum of decimal digits of n^3.

Original entry on oeis.org

1, 9, 18, 28, 36, 45, 55, 63, 81, 82, 90, 108, 127, 144, 162, 181, 198, 216, 244, 252, 270, 289, 306, 324, 343, 369, 396, 415, 441, 450, 478, 504, 531, 550, 576, 603, 622, 648, 675, 685, 711, 738, 766, 792, 810, 838, 855, 873, 901, 909, 927, 946, 981, 1008
Offset: 1

Views

Author

Labos Elemer, May 27 2002

Keywords

References

  • N. Agronomof, Question 4420, L'Intermédiaire des Math. 21 (1914), 147.

Crossrefs

Partial sums of A004164.

Programs

  • Mathematica
    s=0; Do[s=s+Apply[Plus, IntegerDigits[n^3]]; Print[s], {n, 1, 128}]
    nxt[{n_,a_}]:={n+1,a+Total[IntegerDigits[(n+1)^3]]}; NestList[nxt,{1,1},60][[;;,2]] (* Harvey P. Dale, Aug 30 2025 *)

A333034 a(n) is the sum of the digits of the squares of all n-digit numbers.

Original entry on oeis.org

69, 1410, 21921, 298725, 3792660, 46016727, 541129686, 6221175405, 70311424443, 784112741880, 8651123311875, 94611219470547
Offset: 1

Views

Author

Robert Israel, Mar 05 2020

Keywords

Comments

a(n) == 6 (mod 9). - Robert Israel, Mar 06 2020

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

Formula

a(n) = A071317(10^n) - A071317(10^(n-1)).

Extensions

a(8)-a(9) from Hugo Pfoertner, Mar 05 2020
a(10)-a(12) from Giovanni Resta, Mar 07 2020

A071122 a(n) = a(n-1) + sum of decimal digits of 2^n.

Original entry on oeis.org

2, 6, 14, 21, 26, 36, 47, 60, 68, 75, 89, 108, 128, 150, 176, 201, 215, 234, 263, 294, 320, 345, 386, 423, 452, 492, 527, 570, 611, 648, 695, 753, 815, 876, 935, 999, 1055, 1122, 1193, 1254, 1304, 1350, 1406, 1464, 1526, 1596, 1664, 1737, 1802, 1878, 1958
Offset: 1

Views

Author

Labos Elemer, May 27 2002

Keywords

Crossrefs

Programs

  • Mathematica
    s=0; Do[s=s+Apply[Plus, IntegerDigits[2^n]]; Print[s], {n, 1, 128}]

A099358 a(n) = sum of digits of k^4 as k runs from 1 to n.

Original entry on oeis.org

1, 8, 17, 30, 43, 61, 68, 87, 105, 106, 122, 140, 162, 184, 202, 227, 246, 273, 283, 290, 317, 339, 370, 397, 422, 459, 477, 505, 530, 539, 561, 592, 619, 644, 663, 699, 727, 752, 770, 783, 814, 841, 866, 903, 921, 958, 1001, 1028, 1059, 1072, 1099, 1124, 1161
Offset: 1

Views

Author

Yalcin Aktar, Nov 16 2004

Keywords

Comments

Partial sums of A055565.

Examples

			a(3) = sum_digits(1^4) + sum_digits(2^4) + sum_digits(3^4) = 1 + 7 + 9 = 17.
		

Crossrefs

Cf. k^1 in A037123, k^2 in A071317 & k^3 in A071121.

Programs

  • Mathematica
    f[n_] := Block[{s = 0, k = 1}, While[k <= n, s = s + Plus @@ IntegerDigits[k^4]; k++ ]; s]; Table[ f[n], {n, 50}] (* Robert G. Wilson v, Nov 18 2004 *)
    Accumulate[Table[Total[IntegerDigits[n^4]],{n,60}]] (* Harvey P. Dale, Jun 08 2021 *)

Formula

a(n) = a(n-1) + sum of decimal digits of n^4.
a(n) = sum(k=1, n, sum(m=0, floor(log(k^4)), floor(10((k^4)/(10^(((floor(log(k^4))+1))-m)) - floor((k^4)/(10^(((floor(log(k^4))+1))-m))))))).
General formula: a(n)_p = sum(k=1, n, sum(m=0, floor(log(k^p)), floor(10((k^p)/(10^(((floor(log(k^p))+1))-m)) - floor ((k^p)/(10^(((floor(log(k^p))+1))-m))))))). Here a(n)_p is a sum of digits of k^p from k=1 to n.

Extensions

Edited and extended by Robert G. Wilson v, Nov 18 2004
Existing example replaced with a simpler one by Jon E. Schoenfield, Oct 20 2013
Showing 1-6 of 6 results.