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.

A277103 Number of partitions of n for which the number of odd parts is equal to the positive alternating sum of the parts.

Original entry on oeis.org

1, 1, 0, 1, 3, 3, 1, 3, 10, 10, 4, 10, 27, 27, 13, 28, 69, 69, 37, 72, 161, 162, 96, 171, 361, 364, 230, 388, 768, 777, 522, 836, 1581, 1605, 1128, 1739, 3145, 3203, 2345, 3495, 6094, 6225, 4712, 6831, 11511, 11794, 9198, 13010, 21293, 21875, 17496, 24239
Offset: 0

Views

Author

Emeric Deutsch, Oct 18 2016

Keywords

Comments

It follows by conjugation that the partition statistics "alternating sum" and "number of odd parts" are equidistributed. Consequently, the self-conjugate partitions satisfy the required condition.
In the first Maple program (improvable) AS gives the positive alternating sum of a finite sequence s, OP gives the number of odd terms of a finite sequence of positive integers.
For the specified value of n, the second Maple program lists the partitions of n counted by a(n).
Number of integer partitions of n with the same number of odd parts as their conjugate. - Gus Wiseman, Jun 27 2021

Examples

			a(3) = 1 because we have [2,1]. The partitions [3] and [1,1,1] do not qualify.
a(4) = 3 because we have [3,1], [2,2], and [2,1,1]. The partitions [4] and [1,1,1,1] do not qualify.
		

Crossrefs

Comparing even parts to odd conjugate parts gives A277579.
Comparing product of parts to product of conjugate parts gives A325039.
The reverse version is A345196.
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A120452 counts partitions of 2n with rev-alt sum 2 (negative: A344741).
A124754 gives alternating sums of standard compositions (reverse: A344618).
A316524 is the alternating sum of the prime indices of n (reverse: A344616).
A344610 counts partitions by sum and positive reverse-alternating sum.
A344611 counts partitions of 2n with reverse-alternating sum >= 0.

Programs

  • Maple
    with(combinat): AS := proc (s) options operator, arrow: abs(add((-1)^(i-1)*s[i], i = 1 .. nops(s))) end proc: OP := proc (s) local ct, j: ct := 0: for j to nops(s) do if `mod`(s[j], 2) = 1 then ct := ct+1 else  end if end do: ct end proc: a := proc (n) local P, c, k: P := partition(n): c := 0: for k to nops(P) do if AS(P[k]) = OP(P[k]) then c := c+1 else end if end do: c end proc: seq(a(n), n = 0 .. 50);
    n := 8: with(combinat): AS := proc (s) options operator, arrow: abs(add((-1)^(i-1)*s[i], i = 1 .. nops(s))) end proc: OP := proc (s) local ct, j: ct := 0: for j to nops(s) do if `mod`(s[j], 2) = 1 then ct := ct+1 else  end if end do: ct end proc: P := partition(n): C := {}: for k to nops(P) do if AS(P[k]) = OP(P[k]) then C := `union`(C, {P[k]}) else  end if end do: C;
    # alternative Maple program:
    b:= proc(n, i, s, t) option remember; `if`(n=0,
          `if`(s=0, 1, 0), `if`(i<1, 0, b(n, i-1, s, t)+
          `if`(i>n, 0, b(n-i, i, s+t*i-irem(i, 2), -t))))
        end:
    a:= n-> b(n$2, 0, 1):
    seq(a(n), n=0..60);  # Alois P. Heinz, Oct 19 2016
  • Mathematica
    b[n_, i_, s_, t_] := b[n, i, s, t] = If[n == 0, If[s == 0, 1, 0], If[i<1, 0, b[n, i-1, s, t] + If[i>n, 0, b[n-i, i, s + t*i - Mod[i, 2], -t]]]]; a[n_] := b[n, n, 0, 1]; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Dec 21 2016, after Alois P. Heinz *)
    conj[y_]:=If[Length[y]==0,y,Table[Length[Select[y,#>=k&]],{k,1,Max[y]}]]; Table[Length[Select[IntegerPartitions[n],Count[#,?OddQ]==Count[conj[#],?OddQ]&]],{n,0,15}] (* Gus Wiseman, Jun 27 2021 *)