login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A277579 Number of partitions of n for which the number of even parts is equal to the positive alternating sum of the parts. 2
1, 0, 1, 1, 1, 2, 3, 3, 4, 6, 7, 9, 13, 15, 19, 25, 31, 38, 48, 59, 74, 90, 111, 136, 166, 201, 246, 297, 357, 431, 522, 621, 745, 892, 1063, 1263, 1503, 1780, 2109, 2491, 2941, 3463, 4077, 4783, 5616, 6576, 7689, 8981, 10486, 12207, 14209, 16516, 19178, 22231 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,6

COMMENTS

In the first Maple program (improvable) AS gives the positive alternating sum of a finite sequence s, EP gives the number of even 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).

LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..1000

EXAMPLE

a(9) = 6: [2,1,1,1,1,1,1,1], [3,2,1,1,1,1], [3,3,2,1], [4,2,2,1], [4,3,1,1], [5,4].

a(10) = 7: [1,1,1,1,1,1,1,1,1,1], [3,2,2,1,1,1], [3,3,1,1,1,1], [4,2,1,1,1,1], [4,3,2,1], [5,5], [6,4].

a(11) = 9: [2,1,1,1,1,1,1,1,1,1], [3,2,1,1,1,1,1,1], [3,3,2,1,1,1], [3,3,3,2], [4,2,2,1,1,1], [4,3,1,1,1,1], [5,2,2,2], [5,4,1,1], [6,5].

MAPLE

with(combinat): AS := proc (s) options operator, arrow: abs(add((-1)^(i-1)*s[i], i = 1 .. nops(s))) end proc: EP := proc (s) local ct, j: ct := 0: for j to nops(s) do if `mod`(s[j], 2) = 0 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]) = EP(P[k]) then c := c+1 else  end if end do: c end proc: seq(a(n), n = 0 .. 30);

n := 8: with(combinat): AS := proc (s) options operator, arrow: abs(add((-1)^(i-1)*s[i], i = 1 .. nops(s))) end proc: EP := proc (s) local ct, j: ct := 0: for j to nops(s) do if `mod`(s[j], 2) = 0 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]) = EP(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+1, 2), -t))))

    end:

a:= n-> b(n$2, 0, 1):

seq(a(n), n=0..60);

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+1, 2], -t]]]]; a[n_] := b[n, n, 0, 1]; Table[a[n], {n, 0, 60}] (* Jean-Fran├žois Alcover, Dec 21 2016, translated from Maple *)

PROG

(Sage)

def a(n):

    AS = lambda s: abs(sum((-1)^i*t for i, t in enumerate(s)))

    EP = lambda s: sum((t+1)%2 for t in s)

    return sum(AS(p) == EP(p) for p in Partitions(n))

print [a(n) for n in (0..30)] # Peter Luschny, Oct 21 2016

CROSSREFS

Cf. A277103.

Sequence in context: A117275 A327725 A253926 * A241447 A081230 A036021

Adjacent sequences:  A277576 A277577 A277578 * A277580 A277581 A277582

KEYWORD

nonn

AUTHOR

Emeric Deutsch and Alois P. Heinz, Oct 20 2016

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 20 08:07 EST 2020. Contains 331081 sequences. (Running on oeis4.)