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.

A240009 Number T(n,k) of partitions of n, where k is the difference between the number of odd parts and the number of even parts; triangle T(n,k), n>=0, -floor(n/2)+(n mod 2)<=k<=n, read by rows.

Original entry on oeis.org

1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 2, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 0, 1, 1, 2, 3, 2, 2, 2, 1, 1, 0, 1, 1, 1, 2, 2, 2, 4, 3, 2, 2, 1, 1, 0, 1, 1, 2, 4, 5, 3, 4, 4, 2, 2, 1, 1, 0, 1, 1, 1, 2, 3, 3, 5, 7, 5, 4, 4, 2, 2, 1, 1, 0, 1, 1, 2, 4, 7, 7, 6, 8, 6, 4, 4, 2, 2, 1, 1, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Mar 30 2014

Keywords

Comments

T(n,k) = T(n+k,-k).
Sum_{k=-floor(n/2)+(n mod 2)..-1} T(n,k) = A108949(n).
Sum_{k=-floor(n/2)+(n mod 2)..0} T(n,k) = A171966(n).
Sum_{k=1..n} T(n,k) = A108950(n).
Sum_{k=0..n} T(n,k) = A130780(n).
Sum_{k=-1..1} T(n,k) = A239835(n).
Sum_{k<>0} T(n,k) = A171967(n).
T(n,-1) + T(n,1) = A239833(n).
Sum_{k=-floor(n/2)+(n mod 2)..n} k * T(n,k) = A209423(n).
Sum_{k=-floor(n/2)+(n mod 2)..n} (-1)^k*T(n,k) = A081362(n) = (-1)^n*A000700(n).

Examples

			T(5,-1) = 1: [2,2,1].
T(5,0) = 2: [4,1], [3,2].
T(5,1) = 1: [5].
T(5,2) = 1: [2,1,1,1].
T(5,3) = 1: [3,1,1].
T(5,5) = 1: [1,1,1,1,1].
Triangle T(n,k) begins:
: n\k : -5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8  9 10 ...
+-----+----------------------------------------------------
:  0  :                 1;
:  1  :                    1;
:  2  :              1, 0, 0, 1;
:  3  :                 1, 1, 0, 1;
:  4  :           1, 1, 0, 1, 1, 0, 1;
:  5  :              1, 2, 1, 1, 1, 0, 1;
:  6  :        1, 1, 1, 1, 2, 2, 1, 1, 0, 1;
:  7  :           1, 2, 3, 2, 2, 2, 1, 1, 0, 1;
:  8  :     1, 1, 2, 2, 2, 4, 3, 2, 2, 1, 1, 0, 1;
:  9  :        1, 2, 4, 5, 3, 4, 4, 2, 2, 1, 1, 0, 1;
: 10  :  1, 1, 2, 3, 3, 5, 7, 5, 4, 4, 2, 2, 1, 1, 0, 1;
		

Crossrefs

Row sums give A000041.
T(2n,n) gives A002865.
T(4n,2n) gives A182746.
T(4n+2,2n+1) gives A182747.
Row lengths give A016777(floor(n/2)).
Cf. A240021 (the same for partitions into distinct parts), A242618 (the same for parts counted without multiplicity).

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
          expand(b(n, i-1)+`if`(i>n, 0, b(n-i, i)*x^(2*irem(i, 2)-1)))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=ldegree(p)..degree(p)))(b(n$2)):
    seq(T(n), n=0..14);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, If[i<1, 0, b[n, i-1] + If[i>n, 0, b[n-i, i]*x^(2*Mod[i, 2]-1)]]]; T[n_] := (degree = Exponent[b[n, n], x]; ldegree = -Exponent[b[n, n] /. x -> 1/x, x]; Table[Coefficient[b[n, n], x, i], {i, ldegree, degree}]); Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Jan 06 2015, translated from Maple *)
  • PARI
    N=20; q='q+O('q^N);
    e(n) = if(n%2!=0, u, 1/u);
    gf = 1 / prod(n=1,N, 1 - e(n)*q^n );
    V = Vec( gf );
    { for (j=1, #V,  \\ print triangle, including leading zeros
        for (i=0, N-j, print1("   "));  \\ padding
        for (i=-j+1, j-1, print1(polcoeff(V[j], i, u),", "));
        print();
    ); }
    /* Joerg Arndt, Mar 31 2014 */

Formula

G.f.: 1 / prod(n>=1, 1 - e(n)*q^n ) = 1 + sum(n>=1, e(n)*q^n / prod(k=1..n, 1-e(k)*q^k) ) where e(n) = u if n odd, otherwise 1/u; see Pari program. [Joerg Arndt, Mar 31 2014]

A239829 Triangular array: T(n,k) = number of partitions of 2n - 1 that have alternating sum 2k - 1.

Original entry on oeis.org

1, 2, 1, 4, 2, 1, 7, 5, 2, 1, 12, 10, 5, 2, 1, 19, 19, 10, 5, 2, 1, 30, 33, 20, 10, 5, 2, 1, 45, 57, 36, 20, 10, 5, 2, 1, 67, 92, 64, 36, 20, 10, 5, 2, 1, 97, 147, 107, 65, 36, 20, 10, 5, 2, 1, 139, 227, 177, 110, 65, 36, 20, 10, 5, 2, 1, 195, 345, 282, 184
Offset: 1

Views

Author

Clark Kimberling, Mar 28 2014

Keywords

Comments

Suppose that p, with parts x(1) >= x(2) >= ... >= x(k), is a partition of n. Define AS(p), the alternating sum of p, by x(1) - x(2) + x(3) - ... + ((-1)^(k-1))*x(k); note that AS(p) has the same parity as n. Column 1 is given by T(n,1) = (number of partitions of 2n-1 having AS(p) = 1) = A000070(n) for n >= 1. Columns 2 and 3 are essentially A000098 and A103924, and the limiting column (after deleting initial 0's), A000712. The sum of numbers in row n is A000041(2n-1). The corresponding array for partitions into distinct parts is given by A152157 (defined as the number of partitions of 2n+1 into 2k+1 odd parts).

Examples

			First nine rows:
1
2 ... 1
4 ... 2 ... 1
7 ... 5 ... 2 ... 1
12 .. 10 .. 5 ... 2 ... 1
19 .. 19 .. 10 .. 5 ... 2 ... 1
30 .. 33 .. 20 .. 10 .. 5 ... 2 ... 1
45 .. 57 .. 36 .. 20 .. 10 .. 5 ... 2 ... 1
67 .. 92 .. 64 .. 36 .. 20 .. 10 .. 5 ... 2 ... 1
The partitions of 5 are 5, 41, 32, 311, 221, 2111, 11111, with respective alternating sums 5, 3, 1, 3, 1, 1, 1, so that row 2 of the array is 4 .. 2 .. 1.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n=0, x^(1/2), `if`(i<1, 0,
          expand(b(n, i-1, t)+`if`(i>n, 0, b(n-i, i, -t)*x^((t*i)/2)))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(2*n-1$2, 1)):
    seq(T(n), n=1..14);  # Alois P. Heinz, Mar 30 2014
  • Mathematica
    z = 15; s[w_] := s[w] = Total[Take[#, ;; ;; 2]] - Total[Take[Rest[#], ;; ;; 2]] &[w]; c[n_] := c[n] = Table[s[IntegerPartitions[n][[k]]], {k, 1, PartitionsP[n]}]; t[n_, k_] := Count[c[2 n - 1], 2 k - 1]; u = Table[t[n, k], {n, 1, z}, {k, 1, n}]
    TableForm[u]  (* A239829, array *)
    Flatten[u]    (* A239829, sequence *)
    (* Peter J. C. Moses, Mar 21 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[n == 0, x^(1/2), If[i<1, 0, Expand[b[n, i-1, t] + If[i>n, 0, b[n-i, i, -t]*x^((t*i)/2)]]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, n}]][b[2n-1, 2n-1, 1]]; Table[T[n], {n, 1, 14}] // Flatten (* Jean-François Alcover, Aug 27 2016, after Alois P. Heinz *)

A239833 Number of partitions of n having an ordering of parts in which no parts of equal parity are adjacent and the first and last terms have the same parity.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 3, 4, 6, 7, 10, 13, 17, 22, 28, 36, 46, 58, 72, 92, 113, 141, 174, 216, 263, 324, 394, 481, 583, 707, 852, 1029, 1235, 1481, 1774, 2118, 2524, 3003, 3567, 4225, 5003, 5906, 6968, 8202, 9646, 11317, 13275, 15531, 18160, 21195, 24718, 28772
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Examples

			a(10) counts these 10 partitions:  [10], [1,8,1], [7,2,1], [3,6,1], [5,4,1], [5,3,2], [3,4,3], [4,1,2,1,2], [2,3,2,1,2], [1,2,1,2,1,2,1].
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(abs(t)>n, 0,
          `if`(n=0, 1, `if`(i<1, 0, b(n, i-1, t)+
          `if`(i>n, 0, b(n-i, i, t+(2*irem(i, 2)-1))))))
        end:
    a:= n-> b(n$2, -1) +b(n$2, 1):
    seq(a(n), n=0..80);  # Alois P. Heinz, Apr 02 2014
  • Mathematica
    p[n_] := p[n] = Select[IntegerPartitions[n], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] == 1 &]; t = Table[p[n], {n, 0, 10}]
    TableForm[t] (* shows the partitions*)
    t = Table[Length[p[n]], {n, 0, 60}] (* A239833 *)
    (* Peter J. C. Moses, Mar 10 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[Abs[t]>n, 0, If[n==0, 1, If[i<1, 0, b[n, i-1, t] + If[i>n, 0, b[n-i, i, t+(2*Mod[i, 2]-1)]]]]]; a[n_] := b[n, n, -1] + b[n, n, 1]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Oct 12 2015, after Alois P. Heinz *)

Formula

a(n) = A239832(n) + A239832(n+1) for n >= 0.
a(n) = A240009(n,-1) + A240009(n,1). - Alois P. Heinz, Apr 02 2014

A239871 Number of strict partitions of n having 1 more even part than odd, so that there is at least one ordering of the parts in which the even and odd parts alternate, and the first and last terms are even.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 1, 1, 2, 1, 4, 1, 6, 1, 9, 2, 12, 3, 16, 6, 20, 10, 25, 17, 30, 26, 36, 40, 43, 57, 51, 81, 61, 110, 74, 148, 91, 193, 113, 250, 144, 316, 184, 397, 239, 491, 311, 603, 407, 732, 530, 885, 692, 1061, 895, 1268, 1155, 1508, 1478, 1790
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

Let c(n) be the number of strict partitions (that is, every part has multiplicity 1) of n having 1 more odd part than even, so that there is an ordering of parts for which the odd and even parts alternate and the first and last terms are odd. Then c(n) = a(n+1) for n >= 0.

Examples

			a(11) counts these 4 partitions:  812, 614, 632, 452.
		

Crossrefs

Column k=-1 of A240021.

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
          abs(t)>n, 0, `if`(n=0, 1, b(n, i-1, t)+
          `if`(i>n, 0, b(n-i, i-1, t+(2*irem(i, 2)-1)))))
        end:
    a:= n-> b(n$2, 1):
    seq(a(n), n=0..80);  # Alois P. Heinz, Apr 02 2014
  • Mathematica
    d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &];
    p[n_] := p[n] = Select[d[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t =  Table[p[n], {n, 0, 20}]
    TableForm[t] (* shows the partitions *)
    u = Table[Length[p[n]], {n, 0, 70}]  (* A239871 *)
    (* Peter J. C. Moses, Mar 10 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[n > i*(i + 1)/2 || Abs[t] > n, 0, If[n == 0, 1, b[n, i - 1, t] + If[i > n, 0, b[n - i, i - 1, t + (2*Mod[i, 2] - 1)]]]]; a[n_] := b[n, n, 1]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Nov 16 2015, after Alois P. Heinz *)

Formula

a(n) = [x^n y^(-1)] Product_{i>=1} 1+x^i*y^(2*(i mod 2)-1). - Alois P. Heinz, Apr 03 2014

A239835 Number of partitions of n such that the absolute value of the difference between the number of odd parts and the number of even parts is <=1.

Original entry on oeis.org

1, 1, 1, 2, 2, 4, 4, 7, 8, 12, 15, 20, 26, 33, 44, 54, 71, 86, 113, 136, 175, 211, 268, 323, 403, 487, 601, 726, 885, 1068, 1292, 1556, 1867, 2244, 2678, 3208, 3809, 4547, 5379, 6398, 7542, 8937, 10506, 12404, 14542, 17110, 20011, 23465, 27381, 32006, 37267
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

Number of partitions of n having an ordering of parts in which no parts of equal parity are adjacent, as in Example.

Examples

			a(8) counts these 8 partitions:  8, 161, 521, 341, 4121, 323, 3212, 21212.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(abs(t)-n>1, 0,
          `if`(n=0, 1, `if`(i<1, 0, b(n, i-1, t)+
          `if`(i>n, 0, b(n-i, i, t+(2*irem(i, 2)-1))))))
        end:
    a:= n-> b(n$2, 0):
    seq(a(n), n=0..80);  # Alois P. Heinz, Apr 01 2014
  • Mathematica
    p[n_] := p[n] = Select[IntegerPartitions[n], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] <= 1 &]; t = Table[p[n], {n, 0, 10}]
    TableForm[t] (* shows the partitions *)
    Table[Length[p[n]], {n, 0, 60}] (* A239835 *)
    (* Peter J. C. Moses, Mar 10 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[Abs[t]-n>1, 0, If[n==0, 1, If[i<1, 0, b[n, i-1, t] + If[i>n, 0, b[n-i, i, t+(2*Mod[i, 2]-1)]]]]]; a[n_] := b[n, n, 0]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Nov 16 2015, after Alois P. Heinz *)

Formula

a(n) = A045931(n) + A239833(n) for n >= 0.
a(n) = Sum_{k=-1..1} A240009(n,k). - Alois P. Heinz, Apr 01 2014

A239872 Number of strict partitions of 2n having 1 more even part than odd, so that there is at least one ordering of the parts in which the even and odd parts alternate, and the first and last terms are even.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 2, 3, 6, 10, 17, 26, 40, 57, 81, 110, 148, 193, 250, 316, 397, 491, 603, 732, 885, 1061, 1268, 1508, 1790, 2120, 2510, 2970, 3517, 4170, 4950, 5887, 7013, 8371, 10005, 11979, 14353, 17217, 20654, 24785, 29725, 35637, 42672, 51046, 60962
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

Let c(n) be the number of strict partitions (that is, every part has multiplicity 1) of 2n having 1 more even part than odd, so that there is an ordering of parts for which the even and odd parts alternate and the first and last terms are even. This sequence is nondecreasing, unlike A239871, of which it is a bisection; the other bisection is A239873.

Examples

			a(9) counts these 3 partitions of 18:  [18], [8,3,4,1,2], [6,5,4,1,2].
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
          abs(t)-n>0, 0, `if`(n=0, 1, b(n, i-1, t)+
          `if`(i>n, 0, b(n-i, i-1, t+(2*irem(i, 2)-1)))))
        end:
    a:= n-> b(2*n$2, 1):
    seq(a(n), n=0..60);  # Alois P. Heinz, Apr 01 2014
  • Mathematica
    d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &]; p[n_] := p[n] = Select[d[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 20}]
    TableForm[t] (* shows the partitions *)
    u = Table[Length[p[2 n]], {n, 0, 40}]  (* A239872 *)
    (* Peter J. C. Moses, Mar 10 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[n > i*(i+1)/2 || Abs[t]-n > 0, 0, If[n == 0, 1, b[n, i-1, t] + If[i>n, 0, b[n-i, i-1, t + (2*Mod[i, 2] - 1)]]]]; a[n_] := b[2*n, 2*n, 1]; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Oct 28 2015, after Alois P. Heinz *)

A239873 Number of strict partitions of 2n + 1 having 1 more even part than odd, so that there is at least one ordering of the parts in which the even and odd parts alternate, and the first and last terms are even.

Original entry on oeis.org

0, 0, 0, 1, 2, 4, 6, 9, 12, 16, 20, 25, 30, 36, 43, 51, 61, 74, 91, 113, 144, 184, 239, 311, 407, 530, 692, 895, 1155, 1478, 1882, 2375, 2983, 3715, 4602, 5660, 6925, 8418, 10187, 12257, 14686, 17514, 20809, 24624, 29049, 34154, 40051, 46842, 54668, 63667
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

Let c(n) be the number of strict partitions (that is, every part has multiplicity 1) of 2n having 1 more even part than odd, so that there is an ordering of parts for which the even and odd parts alternate and the first and last terms are even. This sequence is nondecreasing, unlike A239871, of which it is a bisection; the other bisection is A239872.

Examples

			a(7) counts these 9 partitions of 15:  [12,1,2], [10,1,4], [10,3,2], [4,9,2], [8,1,6], [8,5,2], [8,3,4], [6,7,2], [6,5,4].
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
          abs(t)>n, 0, `if`(n=0, 1, b(n, i-1, t)+
          `if`(i>n, 0, b(n-i, i-1, t+(2*irem(i, 2)-1)))))
        end:
    a:= n-> b(2*n+1$2, 1):
    seq(a(n), n=0..80);  # Alois P. Heinz, Apr 02 2014
  • Mathematica
    d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &]; p[n_] := p[n] = Select[d[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 20}]
    TableForm[t] (* shows the partitions *)
    u = Table[Length[p[2 n + 1]], {n, 0, 38}]  (* A239873 *)
    (* Peter J. C. Moses, Mar 10 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[n > i (i + 1)/2 || Abs[t] > n, 0, If[n == 0, 1, b[n, i-1, t] + If[i>n, 0, b[n-i, i-1, t + (2 Mod[i, 2] - 1)]]]]; a[n_] := b[2n+1, 2n+1, 1]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Aug 29 2016, after Alois P. Heinz *)
Showing 1-7 of 7 results.