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

A194621 Triangle T(n,k), n>=0, 0<=k<=n, read by rows: T(n,k) is the number of partitions of n in which any two parts differ by at most k.

Original entry on oeis.org

1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 5, 5, 5, 2, 5, 6, 7, 7, 7, 4, 6, 9, 10, 11, 11, 11, 2, 7, 10, 13, 14, 15, 15, 15, 4, 8, 14, 17, 20, 21, 22, 22, 22, 3, 9, 15, 22, 25, 28, 29, 30, 30, 30, 4, 10, 20, 27, 34, 37, 40, 41, 42, 42, 42, 2, 11, 21, 33, 41, 48, 51, 54, 55, 56, 56, 56
Offset: 0

Views

Author

Alois P. Heinz, Aug 30 2011

Keywords

Comments

T(n,k) = A000041(n) for n >= 0 and k >= n.

Examples

			T(6,0) = 4: [6], [3,3], [2,2,2], [1,1,1,1,1,1].
T(6,1) = 6: [6], [3,3], [2,1,1,1,1], [2,2,1,1], [2,2,2], [1,1,1,1,1,1].
T(6,2) = 9: [6], [4,2], [3,1,1,1], [3,2,1], [3,3], [2,1,1,1,1], [2,2,1,1], [2,2,2], [1,1,1,1,1,1].
Triangle begins:
  1;
  1, 1;
  2, 2,  2;
  2, 3,  3,  3;
  3, 4,  5,  5,  5;
  2, 5,  6,  7,  7,  7;
  4, 6,  9, 10, 11, 11, 11;
  2, 7, 10, 13, 14, 15, 15, 15;
		

Crossrefs

Columns k=0-10 give (for n>0): A000005, A000027, A117142, A117143, A218506, A218507, A218508, A218509, A218510, A218511, A218512.
Main diagonal gives: A000041.

Programs

  • Maple
    b:= proc(n, i, k) option remember;
          if n<0 or k<0 then 0
        elif n=0 then 1
        elif i<1 then 0
        else b(n, i-1, k-1) +b(n-i, i, k)
          fi
        end:
    T:= (n, k)-> `if`(n=0, 1, 0) +add(b(n-i, i, k), i=1..n):
    seq(seq(T(n, k), k=0..n), n=0..20);
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n < 0 || k < 0, 0, If[n == 0, 1, If[i < 1, 0, b[n, i-1, k-1] + b[n-i, i, k]]]]; t[n_, k_] := If[n == 0, 1, 0] + Sum[b[n-i, i, k], {i, 1, n}]; Table[Table[t[n, k], {k, 0, n}], {n, 0, 20}] // Flatten (* Jean-François Alcover, Dec 09 2013, translated from Maple *)

Formula

G.f. of column k: 1 + Sum_{j>0} x^j / Product_{i=0..k} (1-x^(i+j)).

A117142 Number of partitions of n in which any two parts differ by at most 2.

Original entry on oeis.org

1, 2, 3, 5, 6, 9, 10, 14, 15, 20, 21, 27, 28, 35, 36, 44, 45, 54, 55, 65, 66, 77, 78, 90, 91, 104, 105, 119, 120, 135, 136, 152, 153, 170, 171, 189, 190, 209, 210, 230, 231, 252, 253, 275, 276, 299, 300, 324, 325, 350, 351, 377, 378, 405, 406, 434, 435, 464, 465
Offset: 1

Views

Author

Emeric Deutsch, Feb 27 2006

Keywords

Comments

Equals row sums of triangle A177991. - Gary W. Adamson, May 16 2010
Positive numbers that are either triangular (A000217) or triangular minus 1 (A000096). - Jon E. Schoenfield, Jun 12 2010

Examples

			a(6) = 9 because we have
  1: [6],
  2: [4, 2],
  3: [3, 3],
  4: [3, 2, 1],
  5: [3, 1, 1, 1],
  6: [2, 2, 2],
  7: [2, 2, 1, 1],
  8: [2, 1, 1, 1, 1],
  9: [1, 1, 1, 1, 1, 1]
([5,1] and [4,1,1] do not qualify).
		

Crossrefs

Column k=2 of A194621. - Alois P. Heinz, Oct 17 2012

Programs

  • GAP
    List([1..60],n->(2*n^2+10*n+3+(-1)^n*(2*n-3))/16); # Muniru A Asiru, Dec 21 2018
    
  • Magma
    [(2*n*(n+5) +3 +(-1)^n*(2*n-3))/16: n in [1..60]]; // G. C. Greubel, Jul 18 2023
    
  • Maple
    g:=sum(x^k/(1-x^k)/(1-x^(k+1))/(1-x^(k+2)),k=1..75): gser:=series(g,x=0,70): seq(coeff(gser,x^n),n=1..65); with(combinat): for n from 1 to 7 do P:=partition(n): A:={}: for j from 1 to nops(P) do if P[j][nops(P[j])]-P[j][1]<3 then A:=A union {P[j]} else A:=A fi od: print(A); od: # this program yields the partitions
  • Mathematica
    Table[Count[IntegerPartitions[n], ?(Max[#] - Min[#] <= 2 &)], {n, 30}] (* _Birkas Gyorgy, Feb 20 2011 *)
    Table[(2*n^2 +10*n +3 +(-1)^n*(2*n-3))/16, {n,30}] (* Birkas Gyorgy, Feb 20 2011 *)
    Table[Sum[If[EvenQ[k], 1, (k+1)/2], {k,0,n}], {n,0,60}] (* Jon Maiga, Dec 21 2018 *)
  • PARI
    Vec(x*(x^2-x-1)/((x-1)^3*(x+1)^2) + O(x^100)) \\ Colin Barker, Mar 05 2015
    
  • SageMath
    [(2*n*(n+5) +3 +(-1)^n*(2*n-3))/16 for n in range(1,61)] # G. C. Greubel, Jul 18 2023

Formula

G.f.: Sum_{k>=1} x^k/((1 - x^k)*(1 - x^(k + 1))*(1 - x^(k + 2))). More generally, the g.f. of the number of partitions in which any two parts differ by at most b is Sum_{k>=1} (x^k/(Product_{j=k..k+b} 1 - x^j)).
a(n) = (2*n^2 + 10*n + 3 + (-1)^n * (2*n - 3))/16. - Birkas Gyorgy, Feb 20 2011
G.f.: (1 + x)/(1 - x)/(Q(0) - x^2 - x^3), where Q(k) = 1 + x^2 + x^3 + k*x*(1 + x^2) - x^2*(1 + x*(k + 2))*(1 + k*x)/Q(k+1) ; (continued fraction). - Sergei N. Gladkovskii, Jan 05 2014
G.f.: x*(1 + x - x^2)/((1 - x)^3*(1 + x)^2). - Colin Barker, Mar 05 2015
a(n) = Sum_{k=0..n-1} A152271(k). - Jon Maiga, Dec 21 2018
E.g.f.: (1/16)*( (3 + 2*x)*exp(-x) + (3 + 12*x + 2*x^2)*exp(x) ). - G. C. Greubel, Jul 18 2023
a(n) = A152919(n+1)/2. - Ridouane Oudra, Oct 29 2024

A128508 Number of partitions p of n such that max(p) - min(p) = 3.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 3, 3, 7, 7, 12, 14, 20, 22, 32, 34, 45, 51, 63, 69, 87, 93, 112, 124, 144, 156, 184, 196, 225, 245, 275, 295, 335, 355, 396, 426, 468, 498, 552, 582, 637, 679, 735, 777, 847, 889, 960, 1016, 1088, 1144, 1232, 1288, 1377, 1449, 1539, 1611, 1719
Offset: 0

Views

Author

John W. Layman, May 07 2007

Keywords

Comments

See A008805 and A049820 for the numbers of partitions p of n such that max(p)-min(p)=1 or 2, respectively.

Crossrefs

Programs

  • Mathematica
    np[n_]:=Length[Select[IntegerPartitions[n],Max[#]-Min[#]==3&]]; Array[np,60] (* Harvey P. Dale, Jul 02 2012 *)

Formula

Conjecture. a(1)=0 and, for n>1, a(n+1)=a(n)+d(n), where d(n) is defined as follows: d=0,0,0,1,0 for n=1,...,5 and, for n>5, d(n)=d(n-2)+1 if n=6k or n=6k+4, d(n)=d(n-2) if n=6k+1 or n=6k+3, d(n)=d(n-2)+2Floor[n/6] if n=6k+2 and d(n)=d(n-5) if n=6k+5.
G.f. for number of partitions p of n such that max(p)-min(p) = m is Sum_{k>0} x^(2*k+m)/Product_{i=0..m} (1-x^(k+i)). - Vladeta Jovovic, Jul 04 2007
a(n) = A097364(n,3) = A116685(n,3) = A117143(n) - A117142(n). - Alois P. Heinz, Nov 02 2012

Extensions

More terms from Vladeta Jovovic, Jul 04 2007

A218567 Number of partitions p of n such that max(p)-min(p) = 4.

Original entry on oeis.org

1, 1, 3, 3, 7, 8, 13, 16, 24, 27, 40, 46, 60, 71, 92, 103, 131, 149, 181, 206, 247, 275, 329, 366, 424, 474, 548, 601, 690, 759, 858, 942, 1059, 1152, 1293, 1404, 1555, 1690, 1869, 2013, 2218, 2390, 2614, 2812, 3066, 3282, 3574, 3820, 4131, 4415, 4769, 5071
Offset: 6

Views

Author

Alois P. Heinz, Nov 02 2012

Keywords

Programs

Formula

G.f.: Sum_{k>0} x^(2*k+4)/Product_{j=0..4} (1-x^(k+j)).
a(n) = A097364(n,4) = A116685(n,4) = A194621(n,4) - A194621(n,3) = A218506(n) - A117143(n).

A248851 a(n) = ( 2*n*(2*n^2 + 9*n + 14) + (-1)^n - 1 )/16.

Original entry on oeis.org

0, 3, 10, 22, 41, 68, 105, 153, 214, 289, 380, 488, 615, 762, 931, 1123, 1340, 1583, 1854, 2154, 2485, 2848, 3245, 3677, 4146, 4653, 5200, 5788, 6419, 7094, 7815, 8583, 9400, 10267, 11186, 12158, 13185, 14268, 15409, 16609, 17870, 19193, 20580, 22032
Offset: 0

Views

Author

Luce ETIENNE, Mar 03 2015

Keywords

Comments

Consider a grid of small triangles of side 1 forming a regular polygon with side n*(n+2); a(n) is the number of equilateral triangles of side length >= 1 in this figure which are oriented with the sides of the figure.
This sequence gives the number of triangles of all sizes in a (n^2+2*n)-iamond with a 4*n-gon configuration.
Equals (1/2)*Sum_{j=0..n-1} (n-j)*(n+1-j) + (-1 + (1/8)*Sum_{j=0..(2*n+1-(-1)^n)/4} (2*n+3+(-1)^n-4*j)*(2*n+3-(-1)^n-4*j)) numbers of triangles in a direction and in the opposite direction.

Examples

			From third comment: a(0)=0, a(1)=1+2, a(2)=4+6, a(3)=10+12, a(4)=20+21, a(5)=35+33.
		

Crossrefs

Programs

  • Magma
    [(4*n^3+18*n^2+28*n-(1-(-1)^n)) div 16: n in [0..50]]; // Vincenzo Librandi, Mar 21 2015
  • Mathematica
    CoefficientList[Series[x (x^3 - 2 x^2 + x + 3) / ((x - 1)^4(x + 1)), {x, 0, 50}], x] (* Vincenzo Librandi, Mar 21 2015 *)
    LinearRecurrence[{3,-2,-2,3,-1},{0,3,10,22,41},50] (* Harvey P. Dale, Jan 17 2023 *)
  • PARI
    concat(0, Vec(x*(x^3-2*x^2+x+3)/((x-1)^4*(x+1)) + O(x^100))) \\ Colin Barker, Mar 03 2015
    

Formula

G.f.: x*(x^3-2*x^2+x+3) / ((x-1)^4*(x+1)). - Colin Barker, Mar 03 2015
a(n) = 3*a(n-1)-2*a(n-2)-2*a(n-3)+3*a(n-4)-a(n-5). - Colin Barker, Mar 03 2015

Extensions

Typo in formula fixed by Vincenzo Librandi, Mar 21 2015
Name rewritten using the closed form by Bruno Berselli, Apr 19 2015

A276027 Number of ways to transform a sequence of n ones to a single number by continually removing two numbers and replacing them with their sum modulo 3.

Original entry on oeis.org

1, 1, 1, 2, 4, 7, 18, 43, 93, 266, 702, 1687, 5136, 14405, 36898, 117016, 341842, 914064, 2983027, 8972121, 24743851, 82478973, 253555061, 715745648, 2424954125, 7582390623, 21796481477, 74805170349, 237095926682, 691568408221, 2398418942361, 7686495623620
Offset: 1

Views

Author

Caleb Ji, Aug 16 2016

Keywords

Comments

Can be considered as the number of maximal chains in a poset whose nodes are the possible states of the sequence. In this sense it counts the same things as A002846 when the elements of that poset are taken modulo 3.
Originally this entry had a reference to a paper on the arXiv by Caleb Ji, Enumerative Properties of Posets Corresponding to a Certain Class of No Strategy Games, arXiv:1608.06025 [math.CO], 2016. However, this article has since been removed from the arXiv. - N. J. A. Sloane, Sep 07 2018

Examples

			For n = 4, the two ways are 1111 -> 211 -> 10 -> 1 and 1111 -> 211 -> 22 -> 1.
		

Crossrefs

Similar to A002846 with nodes taken modulo 3.
A117143 is the total number of nodes in this poset.

Programs

  • Maple
    b:= proc(x, y, z) option remember;
          `if`(x+y+z=1, 1, `if`(y>0 and z>0, b(x+1, y-1, z-1), 0)+
          `if`(x>1 or x>0 and y>0 or x>0 and z>0, b(x-1, y, z), 0)+
          `if`(y>1, b(x, y-2, z+1), 0)+`if`(z>1, b(x, y+1, z-2), 0))
        end:
    a:= n-> b(0, n, 0):
    seq(a(n), n=1..35);  # Alois P. Heinz, Aug 18 2016
  • Mathematica
    b[x_,y_,z_] := b[x, y, z] = If[x+y+z==1, 1,  If[y>0 && z>0, b[x+1, y-1, z-1], 0] + If[x>1 || x>0 && y>0 || x>0 && z>0, b[x-1, y, z], 0] + If[y>1, b[x, y-2, z+1], 0] + If[z>1, b[x, y+1, z-2], 0]]; a[n_]:= b[0, n, 0]; Array[a,35] (* Jean-François Alcover, Aug 07 2017, after Alois P. Heinz *)
  • Python
    from sympy.core.cache import cacheit
    @cacheit
    def b(x, y, z): return 1 if x + y + z==1 else (b(x + 1, y - 1, z - 1) if y>0 and z>0 else 0) + (b(x - 1, y, z) if x>1 or x>0 and y>0 or x>0 and z>0 else 0) + (b(x, y - 2, z + 1) if y>1 else 0) + (b(x, y + 1, z - 2) if z>1 else 0)
    def a(n): return b(0, n, 0)
    print([a(n) for n in range(1, 36)]) # Indranil Ghosh, Aug 09 2017, after Maple code

Formula

a(n) = f(0, n, 0) where f(a, b, c) is the number of ways to reach one number beginning with a zeros, b ones, and c twos.
Then f(a, b, c) = f_1 + f_2 + f_3 + f_4 where f_1 = f(a-1, b, c) if a>=2 or a, b >=1 or a,c >=1, f_2 = f(a, b-2, c+1) if b >= 2, f_3 = f(a, b+1, c-2) if c >= 2, and f_4 = f(a+1, b-1, c-1) if b, c >= 1, and each are 0 otherwise. Initial terms: f(a, b, c) = 1 for all 1 <= a+b+c <= 2, where a, b, c >= 0.

Extensions

a(19)-a(32) from Alois P. Heinz, Aug 18 2016

A256666 a(n) = ( 2*n*(2*n^2 + 11*n + 26) - (-1)^n + 1 )/16.

Original entry on oeis.org

0, 5, 14, 29, 51, 82, 123, 176, 242, 323, 420, 535, 669, 824, 1001, 1202, 1428, 1681, 1962, 2273, 2615, 2990, 3399, 3844, 4326, 4847, 5408, 6011, 6657, 7348, 8085, 8870, 9704, 10589, 11526, 12517, 13563, 14666, 15827, 17048, 18330, 19675, 21084, 22559
Offset: 0

Views

Author

Luce ETIENNE, Apr 07 2015

Keywords

Comments

Consider a grid of small triangles of side 1 forming polygon with side n*(n+3): a(n) is the number of equilateral triangles of side length >=1 in this figure that are oriented with the sides of figure.
This sequence gives the number of triangles of all sizes in a ((n^2+3*n))-iamond with a 3*(2*n-1)-gon n>=1.
Equals (1/2)*Sum_{i=0..n-1} (n-i)*(n+1-i) + (-3 + (1/8)*Sum_{j=0..(2*n+3+(-1)^n)/4} (2*n+5-(-1)^n-4*j)*(2 n+5+(-1)^n-4*j) ) numbers of triangles in a direction and in the opposite direction.
It is also a way (3 stages) to surround triangular n^2-iamonds by 3*n triangles side 1: in first stage we obtain A045947, in second stage A248851, in third stage this sequence.

Examples

			From third comment: a(0)=0, a(1)=1+4, a(2)=4+10, a(3)=10+19, a(4)=20+31, a(5)=35+47, a(6)=56+67.
		

Crossrefs

Programs

  • Magma
    [(4*n^3+22*n^2+52*n+1-(-1)^n)/16: n in [0..50]]; // Vincenzo Librandi, Apr 08 2015
  • Mathematica
    Table[(4 n^3 + 22 n^2 + 52 n + 1 - (-1)^n)/16, {n, 0, 50}] (* Vincenzo Librandi, Apr 08 2015 *)
    LinearRecurrence[{3,-2,-2,3,-1},{0,5,14,29,51},50] (* Harvey P. Dale, Aug 18 2020 *)
  • PARI
    concat(0, Vec(x*(2*x^3-3*x^2-x+5)/((x-1)^4*(x+1)) + O(x^100))) \\ Colin Barker, Apr 07 2015
    

Formula

a(n) = 2*A248851(n) - A045947(n) + A004526(n+1).
G.f.: x*(2*x^3-3*x^2-x+5) / ((x-1)^4*(x+1)). - Colin Barker, Apr 07 2015
a(n) = 3*a(n-1)-2*a(n-2)-2*a(n-3)+3*a(n-4)-a(n-5) for n>4. - Colin Barker, Apr 07 2015
Showing 1-7 of 7 results.