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

A022856 a(n) = n-2 + Sum_{i = 1..n-2} (a(i+1) mod a(i)) for n >= 3 with a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 1, 2, 3, 5, 8, 12, 17, 23, 30, 38, 47, 57, 68, 80, 93, 107, 122, 138, 155, 173, 192, 212, 233, 255, 278, 302, 327, 353, 380, 408, 437, 467, 498, 530, 563, 597, 632, 668, 705, 743, 782, 822, 863, 905, 948, 992, 1037, 1083, 1130, 1178, 1227
Offset: 1

Views

Author

Keywords

Comments

Essentially triangular numbers + 2, but with three extra initial terms.

Crossrefs

Programs

  • Mathematica
    a[n_] := If[n<4, 1, (n^2-7n+16)/2]; Array[a, 60] (* Jean-François Alcover, Mar 08 2017 *)
  • PARI
    for(n=1,100, print1(if(n<4, 1, (n^2 - 7*n +16)/2), ", ")) \\ G. C. Greubel, Jul 13 2017

Formula

For n > 3, a(n) = (n^2 - 7*n + 16)/2 = A027689(n-4)/2 = A000217(n-4) + 2 = A000124(n-4) + 1. - Henry Bottomley, Jun 27 2000
a(n) = Sum_{k=0..2} A007318(n-k-2, k) for n > 3. - Johannes W. Meijer, Aug 11 2013
Sum_{n>=1} 1/a(n) = 3 + 2*Pi*tanh(sqrt(15)*Pi/2)/sqrt(15). - Amiram Eldar, Dec 13 2022

A027603 a(n) = n^3 + (n+1)^3 + (n+2)^3 + (n+3)^3.

Original entry on oeis.org

36, 100, 224, 432, 748, 1196, 1800, 2584, 3572, 4788, 6256, 8000, 10044, 12412, 15128, 18216, 21700, 25604, 29952, 34768, 40076, 45900, 52264, 59192, 66708, 74836, 83600, 93024, 103132, 113948, 125496, 137800, 150884, 164772
Offset: 0

Views

Author

Keywords

Comments

Sums of four consecutive cubes. - Wesley Ivan Hurt, Dec 16 2015

Crossrefs

Programs

  • Magma
    [4*n^3 + 18*n^2 + 42*n + 36: n in [0..40]]; // Vincenzo Librandi, Jun 04 2011
    
  • Maple
    A027603:=n->n^3 + (n+1)^3 + (n+2)^3 + (n+3)^3: seq(A027603(n), n=0..50); # Wesley Ivan Hurt, Dec 16 2015
  • Mathematica
    Table[n^3 +(n+1)^3 +(n+2)^3 +(n+3)^3, {n, 0, 33}] (* or *)
    Table[Plus@@(Range[n, n + 3]^3), {n, 0, 33}] (* Alonso del Arte, Jan 24 2011 *)
  • PARI
    Vec(-4*(-9+11*x-10*x^2+2*x^3)/(1-x)^4 + O(x^100)) \\ Altug Alkan, Dec 16 2015
  • Python
    A027603_list, m = [], [24, 12, 28, 36]
    for _ in range(10**2):
        A027603_list.append(m[-1])
        for i in range(3):
            m[i+1] += m[i] # Chai Wah Wu, Dec 15 2015
    
  • Sage
    [n^3+(n+1)^3+(n+2)^3+(n+3)^3 for n in range(0,40)] # Zerinvary Lajos, Jul 03 2008
    

Formula

a(n) = 4*a(n-1) -6*a(n-2) +4*a(n-3) -a(n-4) for n>=4.
a(n) = 4*n^3 + 18*n^2 + 42*n + 36 = 4*A173965(n+2).
From Bruno Berselli, Jan 24 2011: (Start)
G.f.: 4*(9 - 11*x + 10*x^2 - 2*x^3)/(1-x)^4.
a(n) = A027689(n+1) * A016825(n+1). (End)
E.g.f.: 2*(18 + 32*x + 15*x^2 + 2*x^3)*exp(x). - G. C. Greubel, Aug 24 2022

A163253 An interspersion: the order array of the odd-numbered columns of the double interspersion at A161179.

Original entry on oeis.org

1, 4, 2, 9, 5, 3, 16, 10, 7, 6, 25, 17, 13, 11, 8, 36, 26, 21, 18, 14, 12, 49, 37, 31, 27, 22, 19, 15, 64, 50, 43, 38, 32, 28, 23, 20, 81, 65, 57, 51, 44, 39, 33, 29, 24, 100, 82, 73, 66, 58, 52, 45, 40, 34, 30, 121, 101, 91, 83, 74, 67, 59, 53, 46, 41, 35
Offset: 1

Views

Author

Clark Kimberling, Jul 23 2009

Keywords

Comments

A permutation of the natural numbers.
Row 1 consists of the squares.
Beginning with row 5, the columns obey a 3rd-order recurrence:
c(n)=c(n-1)+c(n-2)-c(n-3)+1; thus disregarding row 1, the nonsquares are partitioned by this recurrence.
Except for initial terms, the first ten rows match A000290, A002522, A002061, A059100, A014209, A117950, A027688, A087475, A027689, A117951, and the first column, A035106.

Examples

			Corner:
1....4....9...16...25
2....5...10...17...26
3....7...13...21...31
6...11...18...27...38
The double interspersion A161179 begins thus:
1....4....7...12...17...24
2....3....8...11...18...23
5....6...13...16...25...30
9...10...19...22...33...38
Expel the even-numbered columns, leaving
1....7...17...
2....8...18...
5...13...25...
9...19...33...
Then replace each of those numbers by its rank when all the numbers are jointly ranked.
		

Crossrefs

Formula

Let S(n,k) denote the k-th term in the n-th row. Three cases:
S(1,k)=k^2;
if n is even, then S(n,k)=k^2+(n-2)k+(n^2-2*n+4)/4;
if n>=3 is odd, then S(n,k)=k^2+(n-2)k+(n^2-2*n+1)/4.

Extensions

Edited and augmented by Clark Kimberling, Jul 24 2009

A027716 Numbers k such that k^2 + k + 4 is a palindrome.

Original entry on oeis.org

0, 1, 20, 200, 219, 261, 2000, 2234, 2551, 2613, 20000, 20604, 200000, 202885, 205704, 218354, 2000000, 2155139, 2490266, 2620486, 20000000, 25882353, 200000000, 205705704, 2000000000, 2094600194, 20000000000, 20102030400, 20349812814, 21572321960
Offset: 1

Views

Author

Keywords

Comments

Includes 2*10^k for k>=2. - Robert Israel, Apr 16 2019

Crossrefs

Programs

  • Mathematica
    palQ[n_] := Block[{d = IntegerDigits[n]}, d == Reverse[d]]; f[n_] := n^2 + n + 4; Select[Range[0, 10^5], palQ@ f@ # &] (* Giovanni Resta, Aug 29 2018 *)
    Select[Range[0,3*10^6],PalindromeQ[#^2+#+4]&] (* The program generates the first 20 terms of the sequence. *) (* Harvey P. Dale, Jul 22 2024 *)

Extensions

More terms from Giovanni Resta, Aug 29 2018

A027717 Palindromes of form k^2 + k + 4.

Original entry on oeis.org

4, 6, 424, 40204, 48184, 68386, 4002004, 4992994, 6510156, 6830386, 400020004, 424545424, 40000200004, 41162526114, 42314341324, 47678687674, 4000002000004, 4644626264464, 6201427241026, 6866949496686, 400000020000004, 669896222698966, 40000000200000004
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Table[n^2+n+4,{n,0,25*10^5}],IntegerDigits[#] == Reverse[ IntegerDigits[ #]]&] (* Harvey P. Dale, Mar 05 2015 *)
    Select[Table[n^2+n+4,{n,0,25*10^5}],PalindromeQ] (* Harvey P. Dale, Dec 23 2023 *)

Extensions

More terms from Giovanni Resta, Aug 29 2018

A213921 Natural numbers placed in table T(n,k) layer by layer. The order of placement: at the beginning filled odd places of layer clockwise, next - even places clockwise. Table T(n,k) read by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 10, 8, 9, 13, 17, 14, 6, 16, 21, 26, 22, 11, 12, 25, 31, 37, 32, 18, 15, 20, 36, 43, 50, 44, 27, 23, 24, 30, 49, 57, 65, 58, 38, 33, 19, 35, 42, 64, 73, 82, 74, 51, 45, 28, 29, 48, 56, 81, 91, 101, 92, 66, 59, 39, 34, 41, 63, 72, 100, 111
Offset: 1

Views

Author

Boris Putievskiy, Mar 05 2013

Keywords

Comments

A permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). Enumeration table T(n,k) is layer by layer. The order of the list:
T(1,1)=1;
T(1,2), T(2,1), T(2,2);
. . .
T(1,n), T(3,n), ... T(n,3), T(n,1), T(2,n), T(4,n), ... T(n,4), T(n,2);
...

Examples

			The start of the sequence as table:
   1   2   5  10  17  26 ...
   3   4   8  14  22  32 ...
   7   9   6  11  18  27 ...
  13  16  12  15  23  33 ...
  21  25  20  24  19  28 ...
  31  36  30  35  29  34 ...
  ...
The start of the sequence as triangle array read by rows:
   1;
   2,  3;
   5,  4,  7;
  10,  8,  9, 13;
  17, 14,  6, 16, 21;
  26, 22, 11, 12, 25, 31;
  ...
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    if i > j:
       result=i*i-(j%2)*i+2-int((j+2)/2)
    else:
       result=j*j-((i%2)+1)*j + int((i+3)/2)

Formula

As a table:
T(n,k) = n*n - (k mod 2)*n + 2 - floor((k+2)/2), if n>k;
T(n,k) = k*k - ((n mod 2)+1)*k + floor((n+3)/2), if n<=k.
As a linear sequence:
a(n) = i*i - (j mod 2)*i + 2 - floor((j+2)/2), if i>j;
a(n) = j*j - ((i mod 2)+1)*j + floor((i+3)/2), if i<=j; where i = n-t*(t+1)/2, j = (t*t+3*t+4)/2-n, t = floor((-1+sqrt(8*n-7))/2).

A171746 Let f(n) = n + floor(sqrt(n)). Then a(n) is the smallest number of iterations of f on n such that a perfect square is obtained.

Original entry on oeis.org

3, 2, 1, 5, 2, 4, 1, 3, 7, 2, 4, 6, 1, 3, 5, 9, 2, 4, 6, 8, 1, 3, 5, 7, 11, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 13, 2, 4, 6, 8, 10, 12, 1, 3, 5, 7, 9, 11, 15, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 17, 2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 3, 5
Offset: 1

Views

Author

Neven Juric (neven.juric(AT)apis-it.hr), Oct 07 2010

Keywords

Comments

Iterate A028392, starting with n: a(n) is the number of steps until a square will be reached. - Reinhard Zumkeller, Feb 23 2012

Examples

			f(9)=12, f(12)=15, f(15)=18, f(18)=22, f(22)=26, f(26)=31, f(31)=36. The first square number in this sequence 12,15,18,22,26,31,36 is on the seventh place and therefore a(9)=7.
		

References

  • Matematicko-fizicki list 1/144, problem 2-2, page 29, (1985-1986).

Crossrefs

Programs

  • Haskell
    a171746 = (+ 1) . length . takeWhile (== 0) .
                               map a010052 . tail . iterate a028392
    -- Reinhard Zumkeller, Feb 23 2012, Oct 14 2010
    
  • Mathematica
    f[n_] := Length@ NestWhileList[ # + Floor@Sqrt@# &, n, ! IntegerQ@Sqrt@# || # == n &] - 1; Array[f, 93] (* Robert G. Wilson v, Oct 08 2010 *)
  • PARI
    f(n) = n + sqrtint(n); \\ A028392
    a(n) = my(k=1); while (!issquare(n=f(n)), k++); k; \\ Michel Marcus, Nov 06 2022

Formula

From Robert G. Wilson v, Oct 08 2010: (Start)
a(k)=1 for A002061(n): n^2 - n + 1 for n>1;
a(k)=2 for A002522(n): n^2 + 1 for n>1;
a(k)=3 for A014206(n): n^2 + n + 2 for n>1;
a(k)=4 for A059100(n): n^2 + 2 for n>1;
a(k)=5 for A027688(n): n^2 + n + 3 for n>2;
a(k)=6 for A117950(n): n^2 + 3 for n>2;
a(k)=7 for A027689(n): n^2 + n + 4 for n>4;
a(k)=8 for A087475(n): n^2 + 4 for n>3;
a(k)=9 for A027690(n): n^2 + n + 5 for n>4; ... (End)
a(n^2) = 2*n + 1: a(A000290(n)) = A005408(n). - Reinhard Zumkeller, Oct 14 2010

A367964 Triangle of 2-parameter triangular numbers, read by rows. T(n, k) = (n*(n + 1) + k*(k + 1)) / 2.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 6, 7, 9, 12, 10, 11, 13, 16, 20, 15, 16, 18, 21, 25, 30, 21, 22, 24, 27, 31, 36, 42, 28, 29, 31, 34, 38, 43, 49, 56, 36, 37, 39, 42, 46, 51, 57, 64, 72, 45, 46, 48, 51, 55, 60, 66, 73, 81, 90, 55, 56, 58, 61, 65, 70, 76, 83, 91, 100, 110
Offset: 0

Views

Author

Peter Luschny, Dec 07 2023

Keywords

Comments

If the rows of the triangle are extended for k > n, the array A144216 is created, which is symmetrical to the main diagonal and therefore contains no new information compared to this triangle.

Examples

			Triangle T(n, k) starts:
  0 |  0;
  1 |  1,  2;
  2 |  3,  4,  6;
  3 |  6,  7,  9, 12;
  4 | 10, 11, 13, 16, 20;
  5 | 15, 16, 18, 21, 25, 30;
  6 | 21, 22, 24, 27, 31, 36, 42;
  7 | 28, 29, 31, 34, 38, 43, 49, 56;
  8 | 36, 37, 39, 42, 46, 51, 57, 64, 72;
  9 | 45, 46, 48, 51, 55, 60, 66, 73, 81,  90;
 10 | 55, 56, 58, 61, 65, 70, 76, 83, 91, 100, 110;
.
Start at row 0, column 0 with 0. Go down by adding the column index in step n. At row n, restart the counting and go n steps right by adding the row index in step n, then change direction and go down again by adding the column index. After 3*n steps on this path you are at T(2*n, n) which is 2*triangular(n) + (triangular(2*n) - triangular(n)) = (5*n^2 + 3*n)/2. These are the sliced heptagonal numbers A147875 (see the illustration of Leo Tavares).
.
The equation T(n, k) = (n*(n + 1) + k*(k + 1))/2 can be extended to all n, k in ZZ.
  [n\k] ... -6  -5  -4  -3  -2  -1   0   1   2   3   4   5  ...
  -------------------------------------------------------------
  [-5] ..., 25, 20, 16, 13, 11, 10, 10, 11, 13, 16, 20, 25, ...
  [-4] ..., 21, 16, 12,  9,  7,  6,  6,  7,  9, 12, 16, 21, ...
  [-3] ..., 18, 13,  9,  6,  4,  3,  3,  4,  6,  9, 13, 18, ...
  [-2] ..., 16, 11,  7,  4,  2,  1,  1,  2,  4,  7, 11, 16, ...
  [-1] ..., 15, 10,  6,  3,  1,  0,  0,  1,  3,  6, 10, 15, ...
  [ 0] ..., 15, 10,  6,  3,  1,  0,  0,  1,  3,  6, 10, 15, ...
  [ 1] ..., 16, 11,  7,  4,  2,  1,  1,  2,  4,  7, 11, 16, ...
  [ 2] ..., 18, 13,  9,  6,  4,  3,  3,  4,  6,  9, 13, 18, ...
  [ 3] ..., 21, 16, 12,  9,  7,  6,  6,  7,  9, 12, 16, 21, ...
  [ 4] ..., 25, 20, 16, 13, 11, 10, 10, 11, 13, 16, 20, 25, ...
		

Crossrefs

Cf. A147875 (T(2*n, n)), A016061 (row sums), A367965 (alternating row sums), A143216 (the multiplicative equivalent), A144216 (extended array).

Programs

  • Maple
    T := (n, k) -> (n*(n + 1) + k*(k + 1)) / 2:
    for n from 0 to 10 do seq(T(n, k), k = 0..n) od;
  • Mathematica
    Module[{n=1},NestList[Append[#+n,n*++n]&,{0},10]] (* or *)
    Table[(n(n+1)+k(k+1))/2,{n,0,10},{k,0,n}] (* Paolo Xausa, Dec 07 2023 *)
  • Python
    # A purely additive construction:
    from functools import cache
    @cache
    def a_row(n: int) -> list[int]:
        if n == 0: return [0]
        row = a_row(n - 1) + [0]
        for k in range(n): row[k] += n
        row[n] = row[n - 1] + n
        return row

Formula

Recurrence: T(n, n) = n + T(n, n-1) starting with T(0, 0) = 0.
For k <> n: T(n, k) = n + T(n-1, k).
T(n, k) = t(n) + t(k), where t(n) are the triangular numbers A000217.
G.f.: (x + x*(2 - 5*x + x^2)*y + x^4*y^2)/((1 - x)^3*(1 - x*y)^3). - Stefano Spezia, Dec 07 2023

A214870 Natural numbers placed in table T(n,k) layer by layer. The order of placement: at the beginning filled odd places of layer clockwise, next - even places counterclockwise. T(n,k) read by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 10, 9, 8, 13, 17, 16, 6, 14, 21, 26, 25, 11, 12, 22, 31, 37, 36, 18, 15, 20, 32, 43, 50, 49, 27, 24, 23, 30, 44, 57, 65, 64, 38, 35, 19, 33, 42, 58, 73, 82, 81, 51, 48, 28, 29, 45, 56, 74, 91, 101, 100, 66, 63, 39, 34, 41, 59, 72, 92, 111
Offset: 1

Views

Author

Boris Putievskiy, Mar 11 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1).
Enumeration table T(n,k) layer by layer. The order of the list:
T(1,1)=1;
T(1,2), T(2,1), T(2,2);
. . .
T(1,n), T(3,n), ... T(n,3), T(n,1); T(n,2), T(n,4), ... T(4,n), T(2,n);
. . .

Examples

			The start of the sequence as table:
   1   2   5  10  17  26 ...
   3   4   9  16  25  36 ...
   7   8   6  11  18  27 ...
  13  14  12  15  24  35 ...
  21  22  20  23  19  28 ...
  31  32  30  33  29  34 ...
  ...
The start of the sequence as triangle array read by rows:
   1;
   2,  3;
   5,  4,  7;
  10,  9,  8, 13;
  17, 16,  6, 14, 21;
  26, 25, 11, 12, 22, 31;
  ...
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    if i > j:
       result=i*i-i+(j%2)*(2-(j+1)/2)+((j+1)%2)*(j/2+1)
    else:
       result=j*j-2*(i%2)*j + (i%2)*((i+1)/2+1) + ((i+1)%2)*(-i/2+1)

Formula

As table
T(n,k) = k*k-2*(n mod 2)*k+(n mod 2)*((n+1)/2+1)+((n+1) mod 2)*(-n/2+1), if n<=k;
T(n,k) = n*n-n+(k mod 2)*(2-(k+1)/2)+((k+1) mod 2)*(k/2+1), if n>k.
As linear sequence
a(n) = j*j-2*(i mod 2)*j+(i mod 2)*((i+1)/2+1)+((i+1) mod 2)*(-i/2+1), if i<=j;
a(n) = i*i-i+(j mod 2)*(2-(j+1)/2)+((j+1) mod 2)*(j/2+1), if i>j; where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).

A294070 a(n) = (1/4)*(n^2 - 2*n)^2 + (9/4)*(n^2 - 2*n) + 6.

Original entry on oeis.org

4, 6, 15, 40, 96, 204, 391, 690, 1140, 1786, 2679, 3876, 5440, 7440, 9951, 13054, 16836, 21390, 26815, 33216, 40704, 49396, 59415, 70890, 83956, 98754, 115431, 134140, 155040, 178296, 204079, 232566, 263940, 298390, 336111, 377304, 422176, 470940, 523815
Offset: 1

Views

Author

Jan Lakota Nono, Aug 14 2018

Keywords

Examples

			2*2, 2*3, 3*5, 5*8, 8*12, 12*17, 17*23, 23*30, 30*38, ...
		

Crossrefs

Programs

  • GAP
    List([1..40],n->(n^2-3*n+6)*(n^2-n+4)/4); # Muniru A Asiru, Aug 16 2018
    
  • Magma
    [(n^2-3*n+6)*(n^2-n+4)/4: n in [1..40]]; // Vincenzo Librandi, Aug 30 2018
    
  • Maple
    b:=n->(n^2-3*n+6)/2: seq(b(n)*b(n+1),n=1..40); # Muniru A Asiru, Aug 16 2018
  • Mathematica
    Times@@@Partition[Array[(#^2 -3# +6)/2 &, 40], 2, 1] (* Michael De Vlieger, Sep 24 2018 *)
    LinearRecurrence[{5,-10,10,-5,1}, {4,6,15,40,96}, 40] (* G. C. Greubel, Feb 10 2019 *)
  • PARI
    Vec(x*(4 - 14*x + 25*x^2 - 15*x^3 + 6*x^4)/(1-x)^5 + O(x^40)) \\ Colin Barker, Nov 26 2018
    
  • Sage
    [(n^2-3*n+6)*(n^2-n+4)/4 for n in (1..40)] # G. C. Greubel, Feb 10 2019

Formula

a(n) = A152948(n) * A152948(n+1).
From Muniru A Asiru, Aug 16 2018: (Start)
a(n) = (n^2 - 3*n + 6)*(n^2 - n + 4)/4.
a(n) = A152948(n)*A027689(n-1)/2. (End)
a(n) = A266883(A061925(n-1)). - Bruno Berselli, Aug 30 2018
From Colin Barker, Nov 26 2018: (Start)
G.f.: x*(4 - 14*x + 25*x^2 - 15*x^3 + 6*x^4)/(1 - x)^5.
a(n) = 5*a(n-1) - 10*a(n-2) + 10*a(n-3) - 5*a(n-4) + a(n-5) for n > 5.
a(n) = (24 - 18*n + 13*n^2 - 4*n^3 + n^4)/4. (End)
E.g.f.: (1/4)*exp(x)*(16 + 8*x + 14*x^2 + 6*x^3 + x^4). - Stefano Spezia, Nov 30 2018
Showing 1-10 of 10 results.