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.

A240752 First differences of digit sums of squares, cf. A004159.

Original entry on oeis.org

1, 3, 5, -2, 0, 2, 4, -3, -1, -8, 3, 5, 7, 0, -7, 4, 6, -10, 1, -6, 5, 7, 0, 2, -5, 6, -1, 1, -6, -4, 7, -9, 11, -5, -3, 8, 1, -6, -4, -2, 9, 2, 4, -3, -10, 1, 3, -4, -2, 0, 2, 4, 6, -1, -8, 3, 5, -2, 0, -7, 4, 6, 8, -8, -6, 5, 7, -9, 2, -5, -3, 8, 1, 3, -4
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 12 2014

Keywords

Crossrefs

Programs

  • Haskell
    a240752 n = a240752_list !! (n-1)
    a240752_list = zipWith (-) (tail a004159_list) a004159_list
    
  • Mathematica
    Differences[Total[IntegerDigits[#]]&/@(Range[0,80]^2)] (* Harvey P. Dale, Mar 10 2019 *)
  • PARI
    a(n) = sumdigits(n^2) - sumdigits((n-1)^2); \\ Michel Marcus, Jan 24 2022
    
  • Python
    def A240752(n): return sum(map(int,str(m:=n**2)))-sum(map(int,str(m-(n<<1)+1))) # Chai Wah Wu, Mar 15 2023

Formula

a(n) = A004159(n) - A004159(n-1).
a(n) = A007953(A000290(n)) - A007953(A000290(n-1)).
a(A202089(n)+1) = 0; a(A239878(n)+1) = 1; a(A240754(n)+1) = -1.

Extensions

Formulas adapted to offset by Michel Marcus, Jan 25 2022