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

A081344 Natural numbers in square maze arrangement, read by antidiagonals.

Original entry on oeis.org

1, 2, 4, 9, 3, 5, 10, 8, 6, 16, 25, 11, 7, 15, 17, 26, 24, 12, 14, 18, 36, 49, 27, 23, 13, 19, 35, 37, 50, 48, 28, 22, 20, 34, 38, 64, 81, 51, 47, 29, 21, 33, 39, 63, 65, 82, 80, 52, 46, 30, 32, 40, 62, 66, 100, 121, 83, 79, 53, 45, 31, 41, 61, 67, 99, 101, 122, 120, 84, 78, 54
Offset: 1

Views

Author

Paul Barry, Mar 19 2003

Keywords

Comments

Arrange the natural numbers by taking clockwise and counterclockwise turns. Begin (LL) and then repeat (RRR)(LLL).
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. - Boris Putievskiy, Dec 16 2012
For generalizations see A219159, A213928. - Boris Putievskiy, Mar 10 2013

Examples

			The start of the sequence as table T(i,j), i,j > 0:
   1   4    5    16 ...
   2   3    6    15 ...
   9   8    7    14 ...
  10  11   12    13 ...
  ....
		

Crossrefs

Cf. A219159, A213928. The main diagonal is A002061. The following appear within interlaced sequences: A016754, A001844, A053755, A004120. The first row is A081345. The first column is A081346. The inverse permutation A194280, the first inverse function (numbers of rows) A220603, the second inverse function (numbers of columns) A220604.

Programs

  • Mathematica
    T[n_, k_] := T[n, k] = Which[OddQ[n] && k==1, n^2, EvenQ[k] && n==1, k^2, EvenQ[n] && k==1, T[n-1, 1]+1, OddQ[k] && n==1, T[1, k-1]+1, k <= n, T[n, k-1]+1 - 2 Mod[n, 2], True, T[n-1, k]-1 + 2 Mod[k, 2]]; Table[T[n-k+1, k], {n, 1, 12}, {k, 1, n}] // Flatten (* Jean-François Alcover, Feb 20 2019 *)
  • 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 j >= i:
         m=(j-1)**2 + j + (j-i)*(-1)**(j-1)
    else:
         m=(i-1)**2 + i - (i-j)*(-1)**(i-1)
    # Boris Putievskiy, Dec 19 2012
    
  • Python
    from math import isqrt
    def A081344(n):
        t = (k:=isqrt(m:=n<<1))+((m<<2)>(k<<2)*(k+1)+1)-1
        i, j = n-(t*(t+1)>>1), (t*(t+3)>>1)+2-n
        r = max(i,j)
        return (r-1)**2+r+(j-i if r&1 else i-j) # Chai Wah Wu, Nov 04 2024

Formula

From Boris Putievskiy, Dec 19 2012: (Start)
a(n) = (i-1)^2 + i + (i-j)*(-1)^(i-1) if i >= j,
a(n) = (j-1)^2 + j - (j-i)*(-1)^(j-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). (End)
Enumeration by boustrophedonic ("ox-plowing") method: If i >= j: T(i,j)=(i-1)^2+i + (i-j)*(-1)^(i-1), if i < j: T(i,j)=(j-1)^2+j - (j-i)*(-1)^(j-1). - Boris Putievskiy, Dec 19 2012
T(i,j) = m^2 - m + 1 - (i - j)*(-1)^m where m = max(i,j). - Ziad Ahmed, Jun 09 2025

A005337 Number of ways in which n identical balls can be distributed among 4 boxes in a row such that each pair of adjacent boxes contains at least 4 balls.

Original entry on oeis.org

15, 40, 76, 124, 185, 260, 350, 456, 579, 720, 880, 1060, 1261, 1484, 1730, 2000, 2295, 2616, 2964, 3340, 3745, 4180, 4646, 5144, 5675, 6240, 6840, 7476, 8149, 8860, 9610, 10400, 11231, 12104, 13020, 13980, 14985
Offset: 8

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A005338, A005339, A005340. A column of A259975.

Programs

  • Maple
    A005337:=(15-20*z+6*z**2)/(z-1)**4; # Simon Plouffe in his 1992 dissertation
  • Mathematica
    CoefficientList[Series[(15 - 20 x + 6 x^2)/(1 - x)^4, {x, 0, 40}], x] (* Vincenzo Librandi, Oct 14 2013 *)
    LinearRecurrence[{4,-6,4,-1},{15,40,76,124},50] (* Harvey P. Dale, May 11 2014 *)

Formula

G.f.: x^8*(15 - 20*x + 6*x^2)/(1 - x)^4.
a(n) = (546 - 169*n + 6*n^2 + n^3)/6. [Colin Barker, Jul 08 2012]

Extensions

G.f. corrected by Colin Barker, Jul 08 2012
Name clarified by Alois P. Heinz, Oct 02 2017

A005338 Number of ways in which n identical balls can be distributed among 5 boxes in a row such that each pair of adjacent boxes contains at least 4 balls.

Original entry on oeis.org

1, 8, 31, 85, 190, 360, 610, 956, 1415, 2005, 2745, 3655, 4756, 6070, 7620, 9430, 11525, 13931, 16675, 19785, 23290, 27220, 31606, 36480, 41875, 47825, 54365, 61531, 69360, 77890, 87160, 97210, 108081, 119815, 132455, 146045, 160630
Offset: 8

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Magma
    I:=[1, 8, 31, 85, 190, 360, 610]; [n le 7 select I[n] else 5*Self(n-1)-10*Self(n-2)+10*Self(n-3)-5*Self(n-4)+Self(n-5): n in [1..40]]; // Vincenzo Librandi, May 11 2012
  • Mathematica
    f[x_] := x^8*(1 + 3*x + x^2 - 11*x^5 + 7*x^6)/(1 - x)^5; Drop[ CoefficientList[ Series[f[x], {x, 0, 44}], x], 8] (* Jean-François Alcover, Oct 05 2011, after Vladeta Jovovic *)
    LinearRecurrence[{5,-10,10,-5,1},{1,8,31,85,190,360,610},40] (* Harvey P. Dale, Aug 26 2019 *)

Formula

G.f.: x^8*(1 + 3*x + x^2 - 11*x^5 + 7*x^6)/(1 - x)^5. - Vladeta Jovovic, Apr 13 2008
a(n) = (n^4 + 10*n^3 - 445*n^2 + 2690*n - 1656)/24 for n > 9. - Colin Barker, May 10 2012

Extensions

Corrected and extended by Vladeta Jovovic, Apr 13 2008
Name clarified by Alois P. Heinz, Oct 02 2017

A005340 Number of ways in which n identical balls can be distributed among 7 boxes in a row such that each pair of adjacent boxes contains at least 4 balls.

Original entry on oeis.org

1, 13, 76, 295, 889, 2188, 4652, 8891, 15686, 26011, 41056, 62251, 91291, 130162, 181168, 246959, 330560, 435401, 565348, 724735, 918397, 1151704, 1430596, 1761619, 2151962, 2609495, 3142808, 3761251, 4474975, 5294974, 6233128
Offset: 12

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    f[x_] := x^12*(1 + 6*x + 6*x^2 + x^3 - 66*x^5 + 74*x^6 - 21*x^7)/(1-x)^7; Drop[ CoefficientList[ Series[f[x], {x, 0, 42}], x], 12] (* Jean-François Alcover, Oct 05 2011, after Vladeta Jovovic *)
    LinearRecurrence[{7,-21,35,-35,21,-7,1},{1,13,76,295,889,2188,4652,8891},40] (* Harvey P. Dale, Apr 03 2025 *)

Formula

G.f.: x^12*(1 + 6*x + 6*x^2 + x^3 - 66*x^5 + 74*x^6 - 21*x^7)/(1-x)^7. - Vladeta Jovovic, Apr 13 2008

Extensions

More terms from Vladeta Jovovic, Apr 13 2008
Name clarified by Alois P. Heinz, Oct 02 2017

A005339 Number of ways in which n identical balls can be distributed among 6 boxes in a row such that each pair of adjacent boxes contains at least 4 balls.

Original entry on oeis.org

35, 154, 424, 930, 1775, 3080, 4985, 7650, 11256, 16006, 22126, 29866, 39501, 51332, 65687, 82922, 103422, 127602, 155908, 188818, 226843, 270528, 320453, 377234, 441524, 514014, 595434, 686554, 788185, 901180, 1026435, 1164890, 1317530
Offset: 12

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    Drop[CoefficientList[Series[x^12(35-56x+25x^2-4x^3+x^6)/(1-x)^6, {x,0, 60}], x],12] (* or *) Join[{35},LinearRecurrence[{6,-15,20,-15,6,-1},{154,424,930,1775,3080,4985},48]] (* Harvey P. Dale, Aug 12 2011 *)

Formula

G.f.: x^12*(35 - 56*x + 25*x^2 - 4*x^3 + x^6)/(1-x)^6. - Vladeta Jovovic, Apr 13 2008
a(n) = 6*a(n-1) - 15*a(n-2) + 20*a(n-3) - 15*a(n-4) + 6*a(n-5) - a(n-6), a(12)=35, a(13)=154, a(14)=424, a(15)=930, a(16)=1775, a(17)=3080, a(18)=4985. - Harvey P. Dale, Aug 12 2011

Extensions

More terms from Vladeta Jovovic, Apr 13 2008
Name clarified by Alois P. Heinz, Oct 02 2017

A081345 First row in maze arrangement of natural numbers A081344.

Original entry on oeis.org

1, 4, 5, 16, 17, 36, 37, 64, 65, 100, 101, 144, 145, 196, 197, 256, 257, 324, 325, 400, 401, 484, 485, 576, 577, 676, 677, 784, 785, 900, 901, 1024, 1025, 1156, 1157, 1296, 1297, 1444, 1445, 1600, 1601, 1764, 1765, 1936, 1937, 2116, 2117, 2304, 2305, 2500
Offset: 0

Views

Author

Paul Barry, Mar 19 2003

Keywords

Crossrefs

Cf. A081346.

Programs

  • Magma
    [n^2+n+1-n*(-1)^n: n in [0..50]]; // Vincenzo Librandi, Aug 08 2013
  • Mathematica
    CoefficientList[Series[(5 x^3 - x^2 + 3 x + 1) / ((1 - x)^3 (1 + x)^2), {x, 0, 50}], x] (* Vincenzo Librandi, Aug 08 2013 *)

Formula

a(n) = n^2 + n + 1 - n*(-1)^n = n^2 + n + 1 + n*(-1)^(n+1).
a(2*n) = A053755(n), a(2*n+1) = 4 * A004120(n).
G.f.: (5*x^3-x^2+3*x+1)/((1-x)^3*(1+x)^2). [Colin Barker, Sep 03 2012]

A259975 Irregular triangle read by rows: T(n,k) = number of ways of placing n balls into k boxes in such a way that any two adjacent boxes contain at least 4 balls.

Original entry on oeis.org

1, 1, 1, 1, 1, 5, 1, 1, 6, 4, 1, 7, 9, 1, 8, 16, 1, 9, 25, 15, 1, 1, 10, 35, 40, 8, 1, 11, 46, 76, 31, 1, 12, 58, 124, 85, 1, 13, 71, 185, 190, 35, 1, 1, 14, 85, 260, 360, 154, 13, 1, 15, 100, 350, 610, 424, 76, 1, 16, 116, 456, 956, 930, 295
Offset: 0

Views

Author

N. J. A. Sloane, Jul 12 2015

Keywords

Examples

			Triangle begins:
  1;
  1;
  1;
  1;
  1,  5,   1;
  1,  6,   4;
  1,  7,   9;
  1,  8,  16;
  1,  9,  25,  15,   1;
  1, 10,  35,  40,   8;
  1, 11,  46,  76,  31;
  1, 12,  58, 124,  85;
  1, 13,  71, 185, 190,  35,  1;
  1, 14,  85, 260, 360, 154, 13;
  1, 15, 100, 350, 610, 424, 76;
  ...
		

Crossrefs

Row sums give A257666.

Programs

  • Maple
    b:= proc(n, v) option remember; expand(`if`(n=0,
          `if`(v=0, 1+x, 1), add(x*b(n-j, max(0, 4-j)), j=v..n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..degree(p)))(b(n, 0)):
    seq(T(n), n=0..20);  # Alois P. Heinz, Jul 12 2015
  • Mathematica
    b[n_, v_] := b[n, v] = Expand[If[n == 0, If[v == 0, 1+x, 1], Sum[x*b[n-j, Max[0, 4-j]], {j, v, n}]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 20}] // Flatten (* Jean-François Alcover, Feb 13 2016, after Alois P. Heinz *)

Extensions

More terms from Alois P. Heinz, Jul 12 2015

A302537 a(n) = (n^2 + 13*n + 2)/2.

Original entry on oeis.org

1, 8, 16, 25, 35, 46, 58, 71, 85, 100, 116, 133, 151, 170, 190, 211, 233, 256, 280, 305, 331, 358, 386, 415, 445, 476, 508, 541, 575, 610, 646, 683, 721, 760, 800, 841, 883, 926, 970, 1015, 1061, 1108, 1156, 1205, 1255, 1306, 1358, 1411, 1465, 1520, 1576
Offset: 0

Views

Author

Keywords

Comments

Binomial transform of [1, 7, 1, 0, 0, 0, ...].
Numbers m > 0 such that 8*m + 161 is a square.

Examples

			Illustration of initial terms (by the formula a(n) = A052905(n) + 3*n):
.                                                                    o
.                                                                  o o
.                                                    o           o o o
.                                                  o o         o o o o
.                                      o         o o o       o o o o o
.                                    o o       o o o o     o o o o o o
.                          o       o o o     o o o o o   o . . . . . o
.                        o o     o o o o   o . . . . o   o . . . . . o
.                o     o o o   o . . . o   o . . . . o   o . . . . . o
.              o o   o . . o   o . . . o   o . . . . o   o . . . . . o
.        o   o . o   o . . o   o . . . o   o . . . . o   o . . . . . o
.      o o   o . o   o . . o   o . . . o   o . . . . o   o . . . . . o
.  o   o o   o o o   o o o o   o o o o o   o o o o o o   o o o o o o o
.        o     o o     o o o     o o o o     o o o o o     o o o o o o
.        o     o o     o o o     o o o o     o o o o o     o o o o o o
.        o     o o     o o o     o o o o     o o o o o     o o o o o o
----------------------------------------------------------------------
.  1     8      16        25          35            46              58
		

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics: A Foundation for Computer Science, Addison-Wesley, 1994.

Crossrefs

Sequences whose n-th terms are of the form binomial(n, 2) + n*k + 1:
A152947 (k = 0); A000124 (k = 1); A000217 (k = 2); A034856 (k = 3);
A052905 (k = 4); A051936 (k = 5); A246172 (k = 6).

Programs

  • Magma
    A302537:= func< n | ((n+1)^2 +12*n +1)/2 >;
    [A302537(n): n in [0..50]]; // G. C. Greubel, Jan 21 2025
    
  • Maple
    a := n -> (n^2 + 13*n + 2)/2;
    seq(a(n), n = 0 .. 100);
  • Mathematica
    Table[(n^2 + 13 n + 2)/2, {n, 0, 100}]
    CoefficientList[ Series[(5x^2 - 5x - 1)/(x - 1)^3, {x, 0, 50}], x] (* or *)
    LinearRecurrence[{3, -3, 1}, {1, 8, 16}, 51] (* Robert G. Wilson v, May 19 2018 *)
  • Maxima
    makelist((n^2 + 13*n + 2)/2, n, 0, 100);
    
  • PARI
    a(n) = (n^2 + 13*n + 2)/2; \\ Altug Alkan, Apr 12 2018
    
  • Python
    def A302537(n): return (n**2 + 13*n + 2)//2
    print([A302537(n) for n in range(51)]) # G. C. Greubel, Jan 21 2025

Formula

a(n) = binomial(n + 1, 2) + 6*n + 1 = binomial(n, 2) + 7*n + 1.
a(n) = a(n-1) + n + 6.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n >= 3, where a(0) = 1, a(1) = 8 and a(2) = 16.
a(n) = 2*a(n-1) - a(n-2) + 1.
a(n) = A004120(n+1) for n > 1.
a(n) = A056119(n) + 1.
a(n) = A152947(n+1) + A008589(n).
a(n) = A060544(n+1) - A002939(n).
a(n) = A000578(n+1) - A162261(n) for n > 0.
G.f.: (1 + 5*x - 5*x^2)/(1 - x)^3.
E.g.f.: (1/2)*(2 + 14*x + x^2)*exp(x).
Sum_{n>=0} 1/a(n) = 24097/45220 + 2*Pi*tan(sqrt(161)*Pi/2) / sqrt(161) = 1.4630922534498496... - Vaclav Kotesovec, Apr 11 2018

A356754 Triangle read by rows: T(n,k) = ((n-1)*(n+2))/2 + 2*k.

Original entry on oeis.org

2, 4, 6, 7, 9, 11, 11, 13, 15, 17, 16, 18, 20, 22, 24, 22, 24, 26, 28, 30, 32, 29, 31, 33, 35, 37, 39, 41, 37, 39, 41, 43, 45, 47, 49, 51, 46, 48, 50, 52, 54, 56, 58, 60, 62, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87
Offset: 1

Views

Author

Torlach Rush, Aug 25 2022

Keywords

Comments

The first column of the triangle is the Lazy Caterer's sequence A000124.
Each subsequent column starts with A000124(n) + (2 * (n-1)).
The first downward diagonal is A046691(n).
Columns and downward diagonals of the triangle identify many sequences (possibly shifted) in the database. Examples can be found in crossrefs below.
The sum of the n-th upward diagonal of the triangle is A356288(n).

Examples

			Triangle T(n,k) begins:
  n\k   1   2   3   4   5   6   7   8   9  10  11  ...
   1:   2
   2:   4   6
   3:   7   9  11
   4:  11  13  15  17
   5:  16  18  20  22  24
   6:  22  24  26  28  30  32
   7:  29  31  33  35  37  39  41
   8:  37  39  41  43  45  47  49  51
   9:  46  48  50  52  54  56  58  60  62
  10:  56  58  60  62  64  66  68  70  72  74
  11:  67  69  71  73  75  77  79  81  83  85  87
  ...
		

Crossrefs

Programs

  • Mathematica
    Table[((n-1)(n+2))/2+2k,{n,20},{k,n}]//Flatten (* Harvey P. Dale, May 26 2023 *)
  • Python
    def T(n, k): return ((n-1) * (n+2))//2 + 2*k
    for n in range(1, 12):
        for k in range(1,(n+1)): print(T(n,k), end = ', ')
    
  • Python
    # Indexed as a linear sequence.
    def a000124(n): return n*(n+1)//2 + 1
    def a(n):
        l = m = 0
        for k in range(1,n):
            lc = a000124(k - 1)
            if n >= lc:
                l = lc
                m = k
            else: break
        return n + m + (n - l)

Formula

T(n,k) = ((n-1) * (n+2))/2 + 2*k.
T(n,k+1) = T(n,k) + 2, k < n.
Showing 1-9 of 9 results.