%I #25 Aug 17 2014 16:32:41
%S 1,1,2,2,4,4,6,7,11,12,15,19,26,30,37,42,58,64,82,92,120,129,167,181,
%T 241,252,326,346,450,474,606,641,822,863,1088,1146,1454,1526,1898,
%U 2010,2494,2638,3232,3437,4195,4458,5381,5748,6928,7389,8805,9446,11217
%N Number of partitions of n where the frequencies alternate in parity.
%C Let the frequency of the largest summand be f1, the frequency of the next smaller summand be f2, etc. Then the sequence f1, f2, f3, ... alternates in parity.
%H Alois P. Heinz, <a href="/A242984/b242984.txt">Table of n, a(n) for n = 0..1000</a>
%e For example the partition 3,2,2,1 is counted since the frequency of 3 is 1; the frequency of 2 is 2; and the frequency of 1 is 1. So the sequence of frequencies is 1,2,1. Since the terms of this sequence are odd, even, odd this partition is counted.
%p b:= proc(n, i, t) option remember; `if`(n=0, 1, `if`(i<1, 0,
%p b(n, i-1, t) +add(`if`(irem(j+t, 2)=0, 0,
%p b(n-i*j, i-1, 1-t)), j=1..n/i)))
%p end:
%p a:= n-> `if`(n=0, 1, add(b(n$2, j), j=0..1)):
%p seq(a(n), n=0..80); # _Alois P. Heinz_, Aug 17 2014
%t <<Combinatorica`;
%t For[n=1,n<=30,n++,count[n]=1;
%t p={n};
%t For[index=1,index <= PartitionsP[n]-1,index++,
%t p=NextPartition[p];
%t tally=Tally[p];
%t freq=Table[tally[[i]][[2]],{i,1,Length[tally]}];
%t condition=True;
%t For[i=1,i<=Length[freq]-1,i++,
%t If[(EvenQ[freq[[i]]]&&EvenQ[freq[[i+1]]])||
%t ((OddQ[freq[[i]]])&&OddQ[freq[[i+1]]]),condition=False]]
%t If[condition,count[n]++]];
%t ];
%t Print[Table[count[i],{i,1,n-1}]]
%K nonn
%O 0,3
%A _David S. Newman_, Aug 16 2014
%E More terms from _Alois P. Heinz_, Aug 17 2014
|