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

A034705 Numbers that are sums of consecutive squares.

Original entry on oeis.org

0, 1, 4, 5, 9, 13, 14, 16, 25, 29, 30, 36, 41, 49, 50, 54, 55, 61, 64, 77, 81, 85, 86, 90, 91, 100, 110, 113, 121, 126, 135, 139, 140, 144, 145, 149, 169, 174, 181, 190, 194, 196, 199, 203, 204, 221, 225, 230, 245, 255, 256, 265, 271, 280, 284, 285, 289, 294, 302
Offset: 1

Views

Author

Keywords

Comments

Also, differences of any pair of square pyramidal numbers (A000330). These could be called "truncated square pyramidal numbers". - Franklin T. Adams-Watters, Nov 29 2006
If n is the sum of d consecutive squares up to m^2, n = A000330(m) - A000330(m-d) = d*(m^2 - (d-1)*m + (d-1)*(2*d-1)/6) <=> m^2 - (d-1)*m = c := n/d - (d-1)*(2*d-1)/6 <=> m = (d-1)/2 + sqrt((d-1)^2/4 + c) which must be an integer. Moreover, A000330(x) >= x^3/3, so m and d can't be larger than (3*n)^(1/3). - M. F. Hasler, Jan 02 2024

Examples

			All squares (A000290: 0, 1, 4, 9, ...) are in this sequence, since "consecutive" in the definition means a subsequence without interruption, so a single term qualifies.
5 = 1^2 + 2^2 = A000330(2) is in this sequence, and similarly 13 = 2^2 + p3^2  = A000330(3) - A000330(1) and 14 = 1^2 + 2^2 + 3^2 = A000330(3), etc.
		

Crossrefs

Cf. A217843-A217850 (sums of consecutive powers 3 to 10).
Cf. A368570 (first of each pair of consecutive integers in this sequence).

Programs

  • Haskell
    import Data.Set (deleteFindMin, union, fromList); import Data.List (inits)
    a034705 n = a034705_list !! (n-1)
    a034705_list = f 0 (tail $ inits $ a000290_list) (fromList [0]) where
       f x vss'@(vs:vss) s
         | y < x = y : f x vss' s'
         | otherwise = f w vss (union s $ fromList $ scanl1 (+) ws)
         where ws@(w:_) = reverse vs
               (y, s') = deleteFindMin s
    -- Reinhard Zumkeller, May 12 2015
    
  • Mathematica
    nMax = 1000; t = {0}; Do[k = n; s = 0; While[s = s + k^2; s <= nMax, AppendTo[t, s]; k++], {n, Sqrt[nMax]}]; t = Union[t] (* T. D. Noe, Oct 23 2012 *)
  • PARI
    {is_A034705(n)= for(d=1,sqrtnint(n*3,3), my(b = (d-1)/2, s = n/d - (d-1)*(d*2-1)/6 + b^2); denominator(s)==denominator(b)^2 && issquare(s, &s) && return(b+s)); !n} \\ Return the index of the largest square of the sum (or 1 for n = 0) if n is in the sequence, else 0. - M. F. Hasler, Jan 02 2024
    
  • Python
    import heapq
    from itertools import islice
    def agen(): # generator of terms
        m = 0; h = [(m, 0, 0)]; nextcount = 1; v1 = None
        while True:
            (v, s, l) = heapq.heappop(h)
            if v != v1: yield v; v1 = v
            if v >= m:
                m += nextcount*nextcount
                heapq.heappush(h, (m, 1, nextcount))
                nextcount += 1
            v -= s*s; s += 1; l += 1; v += l*l
            heapq.heappush(h, (v, s, l))
    print(list(islice(agen(), 60))) # Michael S. Branicky, Jan 06 2024

Extensions

Terms a(1..10^4) double-checked with independent code by M. F. Hasler, Jan 02 2024

A217843 Numbers which are the sum of one or more consecutive nonnegative cubes.

Original entry on oeis.org

0, 1, 8, 9, 27, 35, 36, 64, 91, 99, 100, 125, 189, 216, 224, 225, 341, 343, 405, 432, 440, 441, 512, 559, 684, 729, 748, 775, 783, 784, 855, 1000, 1071, 1196, 1241, 1260, 1287, 1295, 1296, 1331, 1584, 1728, 1729, 1800, 1925, 1989, 2016, 2024, 2025, 2197
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Comments

Contains A000578 (cubes), A005898 (two consecutive cubes), A027602 (three consecutive cubes), A027603 (four consecutive cubes) etc. - R. J. Mathar, Nov 04 2012
See A265845 for sums of consecutive positive cubes in more than one way. - Reinhard Zumkeller, Dec 17 2015
From Lamine Ngom, Apr 15 2021: (Start)
a(n) can always be expressed as the difference of the squares of two triangular numbers (A000217).
A168566 is the subsequence A000217(n)^2 - 1.
a(n) is also the product of two nonnegative integers whose sum and difference are both promic.
See example and formula sections for details. (End)

Examples

			From _Lamine Ngom_, Apr 15 2021: (Start)
Arrange the positive terms in a triangle as follows:
n\k |   1    2    3    4    5    6    7
----+-----------------------------------
  0 |   1;
  1 |   8,   9;
  2 |  27,  35,  36;
  3 |  64,  91,  99, 100;
  4 | 125, 189, 216, 224, 225;
  5 | 216, 341, 405, 432, 440, 441;
  6 | 343, 559, 684, 748, 775, 783, 784;
Column 1: cubes = A000217(n+1)^2 - A000217(n)^2.
The difference of the squares of two consecutive triangular numbers (A000217) is a cube (A000578).
Column 2: sums of 2 consecutive cubes (A027602).
Column 3: sums of 3 consecutive cubes (A027603).
etc.
Column k: sums of k consecutive cubes.
Row n: A000217(n)^2 - A000217(m)^2, m < n.
T(n,n) = A000217(n)^2 (main diagonal).
T(n,n-1) = A000217(n)^2 - 1 (A168566) (2nd diagonal).
Now rectangularize this triangle as follows:
n\k |   1    2     3     4    5     6   ...
----+--------------------------------------
  0 |   1,   9,   36,  100,  225,  441, ...
  1 |   8,  35,   99,  224,  440,  783, ...
  2 |  27,  91,  216,  432,  775, 1287, ...
  3 |  64, 189,  405,  748, 1260, 1989, ...
  4 | 125, 341,  684, 1196, 1925, 2925, ...
  5 | 216, 559, 1071, 1800, 2800, 4131, ...
  6 | 343, 855, 1584, 2584, 3915, 5643, ...
The general form of terms is:
T(n,k) = [n^4 + A016825(k)*n^3 + A003154(k)*n^2 + A300758(k)*n]/4, sum of n consecutive cubes after k^3.
This expression can be factorized into [n*(n + A005408(k))*(n*(n + A005408(k)) + 4*A000217(k))]/4.
For k = 1, the sequence provides all cubes: T(n,1) = A000578(k).
For k = 2, T(n,2) = A005898(k), centered cube numbers, sum of two consecutive cubes.
For k = 3, T(n,3) = A027602(k), sum of three consecutive cubes.
For k = 4, T(n,4) = A027603(k), sum of four consecutive cubes.
For k = 5, T(n,5) = A027604(k), sum of five consecutive cubes.
T(n,n) = A116149(n), sum of n consecutive cubes after n^3 (main diagonal).
For n = 0, we obtain the subsequence T(0,k) = A000217(n)^2, product of two numbers whose difference is 0*1 (promic) and sum is promic too.
For n = 1, we obtain the subsequence T(1,k) = A168566(x), product of two numbers whose difference is 1*2 (promic) and sum is promic too.
For n = 2, we obtain the subsequence T(2,k) = product of two numbers whose difference is 2*3 (promic) and sum is promic too.
etc.
For n = x, we obtain the subsequence formed by products of two numbers whose difference is the promic x*(x+1) and sum is promic too.
Consequently, if m is in the sequence, then m can be expressed as the product of two nonnegative integers whose sum and difference are both promic. (End)
		

Crossrefs

Cf. A265845 (subsequence).
Cf. A000217 (triangular numbers), A046092 (4*A000217).
Cf. A168566 (A000217^2 - 1).
Cf. A002378 (promics), A016825 (singly even numbers), A003154 (stars numbers).
Cf. A000330 (square pyramidal numbers), A300758 (12*A000330).
Cf. A005408 (odd numbers).

Programs

  • Haskell
    import Data.Set (singleton, deleteFindMin, insert, Set)
    a217843 n = a217843_list !! (n-1)
    a217843_list = f (singleton (0, (0,0))) (-1) where
       f s z = if y /= z then y : f s'' y else f s'' y
                  where s'' = (insert (y', (i, j')) $
                               insert (y' - i ^ 3 , (i + 1, j')) s')
                        y' = y + j' ^ 3; j' = j + 1
                        ((y, (i, j)), s') = deleteFindMin s
    -- Reinhard Zumkeller, Dec 17 2015, May 12 2015
    
  • Mathematica
    nMax = 3000; t = {0}; Do[k = n; s = 0; While[s = s + k^3; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/3)}]; t = Union[t]
  • PARI
    lista(nn) = {my(list = List([0])); for (i=1, nn, my(s = 0); forstep(j=i, 1, -1, s += j^3; if (s > nn^3, break); listput(list, s););); Set(list);} \\ Michel Marcus, Nov 13 2020

Formula

a(n) >> n^2. Probably a(n) ~ kn^2 for some k but I cannot prove this. - Charles R Greathouse IV, Aug 07 2013
a(n) is of the form [x*(x+2*k+1)*(x*(x+2*k+1)+2*k*(k+1))]/4, sum of n consecutive cubes starting from (k+1)^3. - Lamine Ngom, Apr 15 2021

Extensions

Name edited by N. J. A. Sloane, May 24 2021

A217844 Numbers which are the sums of consecutive fourth powers.

Original entry on oeis.org

0, 1, 16, 17, 81, 97, 98, 256, 337, 353, 354, 625, 881, 962, 978, 979, 1296, 1921, 2177, 2258, 2274, 2275, 2401, 3697, 4096, 4322, 4578, 4659, 4675, 4676, 6497, 6561, 7793, 8418, 8674, 8755, 8771, 8772, 10000, 10657, 13058, 14354, 14641, 14979, 15235, 15316
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nMax = 20000; t = {0}; Do[k = n; s = 0; While[s = s + k^4; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/4)}]; t = Union[t]

A217845 Numbers which are the sums of consecutive fifth powers.

Original entry on oeis.org

0, 1, 32, 33, 243, 275, 276, 1024, 1267, 1299, 1300, 3125, 4149, 4392, 4424, 4425, 7776, 10901, 11925, 12168, 12200, 12201, 16807, 24583, 27708, 28732, 28975, 29007, 29008, 32768, 49575, 57351, 59049, 60476, 61500, 61743, 61775, 61776, 91817, 100000, 108624
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nMax = 200000; t = {0}; Do[k = n; s = 0; While[s = s + k^5; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/5)}]; t = Union[t]

A217846 Numbers which are the sums of consecutive sixth powers.

Original entry on oeis.org

0, 1, 64, 65, 729, 793, 794, 4096, 4825, 4889, 4890, 15625, 19721, 20450, 20514, 20515, 46656, 62281, 66377, 67106, 67170, 67171, 117649, 164305, 179930, 184026, 184755, 184819, 184820, 262144, 379793, 426449, 442074, 446170, 446899, 446963, 446964, 531441
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Crossrefs

Subsequences include A001014 and A008516.

Programs

  • Mathematica
    nMax = 10^6; t = {0}; Do[k = n; s = 0; While[s = s + k^6; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/6)}]; t = Union[t]
  • PARI
    list(lim)=my(v=List(apply(n->n^6, [0..sqrtnint(lim\=1,6)])),s); for(n=2,lim, s=n*(n-1)*(2*n-1)*(3*n^4-6*n^3+3*n+1)/42; if(s>lim,break); for(k=n,lim, s+=k^6-(k-n)^6; if(s>lim,break); listput(v,s))); Set(v) \\ Charles R Greathouse IV, Apr 22 2020

A217849 Numbers which are the sums of consecutive ninth powers.

Original entry on oeis.org

0, 1, 512, 513, 19683, 20195, 20196, 262144, 281827, 282339, 282340, 1953125, 2215269, 2234952, 2235464, 2235465, 10077696, 12030821, 12292965, 12312648, 12313160, 12313161, 40353607, 50431303, 52384428, 52646572, 52666255, 52666767, 52666768, 134217728
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nMax = 10^9; t = {0}; Do[k = n; s = 0; While[s = s + k^9; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/9)}]; t = Union[t]

A217847 Numbers which are the sums of consecutive seventh powers.

Original entry on oeis.org

0, 1, 128, 129, 2187, 2315, 2316, 16384, 18571, 18699, 18700, 78125, 94509, 96696, 96824, 96825, 279936, 358061, 374445, 376632, 376760, 376761, 823543, 1103479, 1181604, 1197988, 1200175, 1200303, 1200304, 2097152, 2920695, 3200631, 3278756, 3295140
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nMax = 10^7; t = {0}; Do[k = n; s = 0; While[s = s + k^7; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/7)}]; t = Union[t]

A217848 Numbers which are the sums of consecutive eighth powers.

Original entry on oeis.org

0, 1, 256, 257, 6561, 6817, 6818, 65536, 72097, 72353, 72354, 390625, 456161, 462722, 462978, 462979, 1679616, 2070241, 2135777, 2142338, 2142594, 2142595, 5764801, 7444417, 7835042, 7900578, 7907139, 7907395, 7907396, 16777216, 22542017, 24221633, 24612258
Offset: 1

Views

Author

T. D. Noe, Oct 23 2012

Keywords

Crossrefs

Programs

  • Mathematica
    nMax = 10^8; t = {0}; Do[k = n; s = 0; While[s = s + k^8; s <= nMax, AppendTo[t, s]; k++], {n, nMax^(1/8)}]; t = Union[t]
Showing 1-8 of 8 results.