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.

A239830 Triangular array: T(n,k) = number of partitions of 2n that have alternating sum 2k, with T(0,0) = 1 for convenience.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 3, 5, 2, 1, 5, 9, 5, 2, 1, 7, 17, 10, 5, 2, 1, 11, 28, 20, 10, 5, 2, 1, 15, 47, 35, 20, 10, 5, 2, 1, 22, 73, 62, 36, 20, 10, 5, 2, 1, 30, 114, 102, 65, 36, 20, 10, 5, 2, 1, 42, 170, 167, 109, 65, 36, 20, 10, 5, 2, 1, 56, 253, 262, 182, 110
Offset: 0

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) = A000041(n) for n >= 0, which is the number of partitions of 2n having AS(p) = 0, for n >= 1. Columns 2 and 3 are essentially A000567 and A000710, and the limiting column (after deleting initial 0's), A000712. The sum of numbers in row n is A000041(2n). The corresponding array for partitions into distinct parts is given by A152146 (defined as the number of unrestricted partitions of 2n into 2k even parts).

Examples

			First nine rows:
1
1 ... 1
2 ... 2 ... 1
3 ... 5 ... 2 ... 1
5 ... 9 ... 5 ... 2 ... 1
7 ... 17 .. 10 .. 5 ... 2 ... 1
11 .. 28 .. 20 .. 10 .. 5 ... 2 ... 1
15 .. 47 .. 35 .. 20 .. 10 .. 5 ... 2 ... 1
22 .. 73 .. 62 .. 36 .. 20 .. 10 .. 5 ... 2 ... 1
The partitions of 6 are 6, 51, 42, 411, 33, 321, 3111, 222, 2211, 21111, 111111, with respective alternating sums 6, 4, 2, 4, 0, 2, 2, 2, 0, 2, 0, so that row 3 (counting the top row as row 0) of the array is 3 .. 5 .. 2 .. 1.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n=0, 1, `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=0..n))(b(2*n$2, 1)):
    seq(T(n), n=0..14);  # Alois P. Heinz, Mar 30 2014
  • Mathematica
    z = 16; 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], 2 k]; t[0, 0] = 1; u = Table[t[n, k], {n, 0, z}, {k, 0, n}]
    TableForm[u]  (* A239830, array *)
    Flatten[u]    (* A239830, sequence *)
    (* Peter J. C. Moses, Mar 21 2014 *)

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 *)

A239832 Number of partitions of n 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.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 1, 2, 2, 4, 3, 7, 6, 11, 11, 17, 19, 27, 31, 41, 51, 62, 79, 95, 121, 142, 182, 212, 269, 314, 393, 459, 570, 665, 816, 958, 1160, 1364, 1639, 1928, 2297, 2706, 3200, 3768, 4434, 5212, 6105, 7170, 8361, 9799, 11396, 13322, 15450, 18022
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

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

Examples

			The three partitions counted by a(10) are [10], [4,1,2,1,2], and [2,3,2,1,2].
		

Crossrefs

Column k=-1 of A240009.

Programs

  • Mathematica
    p[n_] := p[n] = Select[IntegerPartitions[n], Count[#, ?OddQ] == -1 + Count[#, ?EvenQ] &]; t = Table[p[n], {n, 0, 10}]
    TableForm[t] (* shows the partitions *)
    Table[Length[p[n]], {n, 0, 30}]  (* A239832 *)
    (* Peter J. C. Moses, Mar 10 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

A239881 Number of strict partitions of n having an ordering in which no parts of equal parity are juxtaposed.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 2, 5, 3, 7, 6, 10, 9, 13, 15, 18, 22, 23, 33, 31, 46, 41, 65, 55, 87, 73, 117, 99, 153, 132, 199, 177, 254, 236, 324, 313, 408, 412, 512, 540, 639, 701, 795, 904, 986, 1159, 1221, 1473, 1509, 1861, 1862, 2336, 2298, 2915, 2830, 3615, 3485
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

A strict partition is one in which every part has multiplicity 1.
a(n) = Sum_{k=-1..1} A240021(n,k). - Alois P. Heinz, Apr 02 2014

Examples

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

Crossrefs

Programs

  • Mathematica
    d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@#] == 1 &];
    p[n_] := p[n] = Select[d[n], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] <= 1 &]; t =  Table[p[n], {n, 0, 12}]
    TableForm[t] (* shows the partitions *)
    u = Table[Length[p[n]], {n, 0, 60}]  (* A239880 *)
    (* Peter J. C. Moses, Mar 10 2014 *)

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

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 7, 7, 10, 11, 14, 15, 19, 22, 26, 30, 35, 42, 47, 56, 62, 76, 83, 100, 108, 132, 142, 171, 184, 222, 239, 284, 306, 363, 394, 460, 500, 581, 636, 730, 802, 914, 1010, 1139, 1262, 1415, 1577, 1753, 1956, 2163, 2423, 2663
Offset: 0

Views

Author

Clark Kimberling, Mar 29 2014

Keywords

Comments

A strict partition is one in which every part has multiplicity 1.
a(n) = A240021(n,-1) + A240021(n,1). - Alois P. Heinz, Apr 02 2014

Examples

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

Crossrefs

Programs

  • Maple
    b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2 or
           abs(t)-n>1, 0, `if`(n=0, abs(t), 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, 0):
    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], Abs[Count[#, ?OddQ] - Count[#, ?EvenQ]] == 1 &]; t =  Table[p[n], {n, 0, 12}]
    TableForm[t] (* shows the partitions *)
    u = Table[Length[p[n]], {n, 0, 60}]  (* A239880 *)
    (* Peter J. C. Moses, Mar 10 2014 *)
    b[n_, i_, t_] := b[n, i, t] = If[n > i*(i+1)/2 || Abs[t]-n>1, 0, If[n==0, Abs[t], 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, 0]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Aug 29 2016, after Alois P. Heinz *)
Showing 1-7 of 7 results.