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-3 of 3 results.

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

A202089 Numbers n such that n^2 and (n+1)^2 have same digit sum.

Original entry on oeis.org

4, 13, 22, 49, 58, 76, 103, 130, 139, 157, 193, 202, 229, 247, 256, 274, 283, 301, 391, 418, 427, 454, 463, 472, 481, 508, 526, 553, 598, 607, 616, 643, 661, 679, 688, 724, 733, 742, 760, 769, 778, 796, 850, 868, 877, 886, 904, 913, 931, 949, 958, 976, 1003
Offset: 1

Views

Author

Zak Seidov, Dec 11 2011

Keywords

Comments

Or numbers n such that A004159(n)=A004159(n+1), or A007953(n^2)=A007953((n+1)^2).
Corresponding digit sums are of the form 7+9k, with k=1, 2, 3,... .
Numbers n are of the form 4+9m, with m=0, 1, 2, 5, 6, 8, 11, ... .
A240752(a(n)) = 0. - Reinhard Zumkeller, Apr 12 2014

Examples

			4^2=16 and 5^2=25 have same digit sum ds=7.
13^2=169 and 14^2=196 have ds=16.
76^2=5776 and 77^2=5929 have ds=25.
526^2=276676 and 527^2=277729 have ds=34.
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a202089 n = a202089_list !! (n-1)
    a202089_list = elemIndices 0 a240752_list
    -- Reinhard Zumkeller, Apr 12 2014
    
  • Mathematica
    cnt = 0; nn = 10000; n = 4; Reap[While[cnt < nn, While[Total[IntegerDigits[n^2]] != Total[IntegerDigits[(n + 1)^2]], n = n + 9]; cnt++; Sow[n]; n = n + 9]][[2, 1]]
  • Python
    def ok(n): return sum(map(int, str(n*n))) == sum(map(int, str((n+1)**2)))
    print(list(filter(ok, range(1004)))) # Michael S. Branicky, Apr 13 2021

A239878 Numbers k with digit_sum(k*k) + 1 = digit_sum((k+1)*(k+1)).

Original entry on oeis.org

0, 18, 27, 36, 45, 72, 81, 108, 153, 198, 216, 225, 243, 252, 270, 297, 306, 342, 369, 396, 423, 441, 450, 477, 486, 495, 504, 513, 522, 549, 558, 576, 603, 630, 639, 657, 693, 702, 729, 747, 756, 783, 801, 846, 891, 918, 954, 963, 972, 981
Offset: 1

Views

Author

Reiner Moewald, Mar 28 2014

Keywords

Comments

All terms are divisible by 9.
The number of terms is unlimited: n = 3*10^z + 6, i.e., digit_sum(n*n) + 1 = 27 + 1 = 28 = digit_sum((n+1)*(n+1)). - Reiner Moewald, Apr 20 2014

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a239878 n = a239878_list !! (n-1)
    a239878_list = elemIndices 1 a240752_list
    -- Reinhard Zumkeller, Apr 12 2014
  • PARI
    isok(n) = (sumdigits(n^2) + 1) == sumdigits((n+1)^2); \\ Michel Marcus, Apr 06 2014
    
  • Python
    def digit_Sum(n):
       integerString = str(n)
       digit_Sum=0
       for digitLetter in integerString:
          digit_Sum = digit_Sum + int(digitLetter)
       return digit_Sum
    count = 0;
    for i in range(20000):
       if(digit_Sum(i*i) + 1 == digit_Sum((i+1)*(i+1))):
          count = count +1
          print(count,"   ",i)
    

Formula

A240752(a(n)) = 1. - Reinhard Zumkeller, Apr 12 2014
Showing 1-3 of 3 results.