OFFSET
0,4
COMMENTS
Note that considering partitions in standard decreasing order, we obtain A001522.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000 (first 201 terms from Giovanni Resta)
EXAMPLE
a(6) = 11 - 3 = 8, because of the 11 partitions of 6 only 3 do not contain a 1 in position 1, a 2 in position 2, or a 3 in position 3, namely (3,3), (2,4) and (6).
MAPLE
b:= proc(n, i) option remember; `if`(n=0, [0, 1],
`if`(i<1, [0$2], b(n, i-1) +`if`(i>n, 0,
(p->[p[1] +coeff(p[2], x, i-1), expand(x*(p[2]-
coeff(p[2], x, i-1)*x^(i-1)))])(b(n-i, i)))))
end:
a:= n-> b(n$2)[1]:
seq(a(n), n=0..70); # Alois P. Heinz, Feb 26 2014
MATHEMATICA
a[n_] := Length@ Select[IntegerPartitions@ n, MemberQ[ Reverse@# - Range@ Length@#, 0] &]; Array[a, 30]
(* Second program: *)
b[n_, i_] := b[n, i] = If[n==0, {0, 1}, If[i<1, {0, 0}, b[n, i-1] + If[i>n, 0, Function[p, {p[[1]] + Coefficient[p[[2]], x, i-1], x*(p[[2]] - Coefficient[p[[2]], x, i-1]*x^(i-1))}][b[n-i, i]]]]]; a[n_] := b[n, n][[1]]; Table[a[n], {n, 0, 70}] (* Jean-François Alcover, Aug 29 2016, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Giovanni Resta, Feb 26 2014
STATUS
approved