login
A160786
The number of odd partitions of consecutive odd integers.
34
1, 2, 4, 8, 16, 29, 52, 90, 151, 248, 400, 632, 985, 1512, 2291, 3431, 5084, 7456, 10836, 15613, 22316, 31659, 44601, 62416, 86809, 120025, 165028, 225710, 307161, 416006, 560864, 752877, 1006426, 1340012, 1777365, 2348821, 3093095, 4059416, 5310255, 6924691
OFFSET
0,2
COMMENTS
It seems that these are partitions of odd length and sum, ranked by A340931. The parts do not have to be odd. - Gus Wiseman, Apr 06 2021
LINKS
FORMULA
a(n) = A027193(2n+1).
EXAMPLE
From Gus Wiseman, Apr 06 2021: (Start)
The a(0) = 1 through a(4) = 16 partitions:
(1) (3) (5) (7) (9)
(111) (221) (322) (333)
(311) (331) (432)
(11111) (421) (441)
(511) (522)
(22111) (531)
(31111) (621)
(1111111) (711)
(22221)
(32211)
(33111)
(42111)
(51111)
(2211111)
(3111111)
(111111111)
(End)
MAPLE
b:= proc(n, i) option remember; `if`(n=0, [1, 0$3],
`if`(i<1, [0$4], b(n, i-1)+`if`(i>n, [0$4], (p->
`if`(irem(i, 2)=0, [p[3], p[4], p[1], p[2]],
[p[2], p[1], p[4], p[3]]))(b(n-i, i)))))
end:
a:= n-> b(2*n+1$2)[2]:
seq(a(n), n=0..40); # Alois P. Heinz, Feb 16 2014
MATHEMATICA
b[n_, i_] := b[n, i] = If[n==0, {1, 0, 0, 0}, If[i<1, {0, 0, 0, 0}, b[n, i-1] + If[i>n, {0, 0, 0, 0}, Function[{p}, If[Mod[i, 2]==0, p[[{3, 4, 1, 2}]], p[[{2, 1, 4, 3}]]]][b[n-i, i]]]]]; a[n_] := b[2*n+1, 2*n+1][[2]]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jul 01 2015, after Alois P. Heinz *)
(* Slow but easy to read *)
a[n_] := Length@IntegerPartitions[2 n + 1, {1, 2 n + 1, 2}]
a /@ Range[0, 25]
(* Leo C. Stein, Nov 11 2020 *)
(* Faster, don't build the partitions themselves *)
(* Number of partitions of n into exactly k parts *)
P[0, 0] = 1;
P[n_, k_] := 0 /; ((k <= 0) || (n <= 0))
P[n_, k_] := P[n, k] = P[n - k, k] + P[n - 1, k - 1]
a[n_] := Sum[P[2 n + 1, k], {k, 1, 2 n + 1, 2}]
a /@ Range[0, 40]
(* Leo C. Stein, Nov 11 2020 *)
PROG
(Python)
# Could be memoized for speedup
def numoddpart(n, m=1):
"""The number of partitions of n into an odd number of parts of size at least m"""
if n < m:
return 0
elif n == m:
return 1
else:
# 1 (namely n = n) and all partitions of the form
# k + even partitions that start with >= k
return 1 + sum([numevenpart(n - k, k) for k in range(m, n//3 + 1)])
def numevenpart(n, m=1):
"""The number of partitions of n into an even number of parts of size at least m"""
if n < 2*m:
return 0
elif n == 2*m:
return 1
else:
return sum([numoddpart(n - k, k) for k in range(m, n//2 + 1)])
[numoddpart(n) for n in range(1, 70, 2)]
(Python)
# dict to memoize
ps = {(0, 0): 1}
def p(n, k):
"""Number of partitions of n into exactly k parts"""
if (n, k) in ps: return ps[(n, k)]
if (n<=0) or (k<=0): return 0
ps[(n, k)] = p(n-k, k) + p(n-1, k-1)
return ps[(n, k)]
def a(n): return sum([p(2*n+1, k) for k in range(1, 2*n+3, 2)])
[a(n) for n in range(0, 41)]
# Leo C. Stein, Nov 11 2020
CROSSREFS
Partitions with all odd parts are counted by A000009 and ranked by A066208.
This is a bisection of A027193 (odd-length partitions), which is ranked by A026424.
The case of all odd parts is counted by A078408 and ranked by A300272.
The even version is A236913, ranked by A340784.
A multiplicative version is A340102.
These partitions are ranked by A340931.
A047993 counts balanced partitions, ranked by A106529.
A058695 counts partitions of odd numbers, ranked by A300063.
A072233 counts partitions by sum and length.
A236914 counts partition of type OO, ranked by A341448.
A340385 counts partitions with odd length and maximum, ranked by A340386.
Sequence in context: A018726 A049884 A085583 * A054154 A292793 A332835
KEYWORD
nonn
AUTHOR
Utpal Sarkar (doetoe(AT)gmail.com), May 26 2009
STATUS
approved