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.

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.

This page as a plain text file.
%I A239835 #14 Nov 16 2015 09:24:34
%S A239835 1,1,1,2,2,4,4,7,8,12,15,20,26,33,44,54,71,86,113,136,175,211,268,323,
%T A239835 403,487,601,726,885,1068,1292,1556,1867,2244,2678,3208,3809,4547,
%U A239835 5379,6398,7542,8937,10506,12404,14542,17110,20011,23465,27381,32006,37267
%N 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.
%C A239835 Number of partitions of n having an ordering of parts in which no parts of equal parity are adjacent, as in Example.
%H A239835 Alois P. Heinz, <a href="/A239835/b239835.txt">Table of n, a(n) for n = 0..1000</a>
%F A239835 a(n) = A045931(n) + A239833(n) for n >= 0.
%F A239835 a(n) = Sum_{k=-1..1} A240009(n,k). - _Alois P. Heinz_, Apr 01 2014
%e A239835 a(8) counts these 8 partitions:  8, 161, 521, 341, 4121, 323, 3212, 21212.
%p A239835 b:= proc(n, i, t) option remember; `if`(abs(t)-n>1, 0,
%p A239835       `if`(n=0, 1, `if`(i<1, 0, b(n, i-1, t)+
%p A239835       `if`(i>n, 0, b(n-i, i, t+(2*irem(i, 2)-1))))))
%p A239835     end:
%p A239835 a:= n-> b(n$2, 0):
%p A239835 seq(a(n), n=0..80);  # _Alois P. Heinz_, Apr 01 2014
%t A239835 p[n_] := p[n] = Select[IntegerPartitions[n], Abs[Count[#, _?OddQ] - Count[#, _?EvenQ]] <= 1 &]; t = Table[p[n], {n, 0, 10}]
%t A239835 TableForm[t] (* shows the partitions *)
%t A239835 Table[Length[p[n]], {n, 0, 60}] (* A239835 *)
%t A239835 (* _Peter J. C. Moses_, Mar 10 2014 *)
%t A239835 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_ *)
%Y A239835 Cf. A239832, A239833, A045931, A239871.
%K A239835 nonn,easy
%O A239835 0,4
%A A239835 _Clark Kimberling_, Mar 29 2014