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.
%I A160786 #25 Apr 08 2021 08:23:22 %S A160786 1,2,4,8,16,29,52,90,151,248,400,632,985,1512,2291,3431,5084,7456, %T A160786 10836,15613,22316,31659,44601,62416,86809,120025,165028,225710, %U A160786 307161,416006,560864,752877,1006426,1340012,1777365,2348821,3093095,4059416,5310255,6924691 %N A160786 The number of odd partitions of consecutive odd integers. %C A160786 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 %H A160786 Alois P. Heinz, <a href="/A160786/b160786.txt">Table of n, a(n) for n = 0..5000</a> %H A160786 V. I. Arnold, <a href="http://pauli.uni-muenster.de/~munsteg/arnold.html">On teaching mathematics</a> %F A160786 a(n) = A027193(2n+1). %e A160786 From _Gus Wiseman_, Apr 06 2021: (Start) %e A160786 The a(0) = 1 through a(4) = 16 partitions: %e A160786 (1) (3) (5) (7) (9) %e A160786 (111) (221) (322) (333) %e A160786 (311) (331) (432) %e A160786 (11111) (421) (441) %e A160786 (511) (522) %e A160786 (22111) (531) %e A160786 (31111) (621) %e A160786 (1111111) (711) %e A160786 (22221) %e A160786 (32211) %e A160786 (33111) %e A160786 (42111) %e A160786 (51111) %e A160786 (2211111) %e A160786 (3111111) %e A160786 (111111111) %e A160786 (End) %p A160786 b:= proc(n, i) option remember; `if`(n=0, [1, 0$3], %p A160786 `if`(i<1, [0$4], b(n, i-1)+`if`(i>n, [0$4], (p-> %p A160786 `if`(irem(i, 2)=0, [p[3], p[4], p[1], p[2]], %p A160786 [p[2], p[1], p[4], p[3]]))(b(n-i, i))))) %p A160786 end: %p A160786 a:= n-> b(2*n+1$2)[2]: %p A160786 seq(a(n), n=0..40); # _Alois P. Heinz_, Feb 16 2014 %t A160786 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_ *) %t A160786 (* Slow but easy to read *) %t A160786 a[n_] := Length@IntegerPartitions[2 n + 1, {1, 2 n + 1, 2}] %t A160786 a /@ Range[0, 25] %t A160786 (* _Leo C. Stein_, Nov 11 2020 *) %t A160786 (* Faster, don't build the partitions themselves *) %t A160786 (* Number of partitions of n into exactly k parts *) %t A160786 P[0, 0] = 1; %t A160786 P[n_, k_] := 0 /; ((k <= 0) || (n <= 0)) %t A160786 P[n_, k_] := P[n, k] = P[n - k, k] + P[n - 1, k - 1] %t A160786 a[n_] := Sum[P[2 n + 1, k], {k, 1, 2 n + 1, 2}] %t A160786 a /@ Range[0, 40] %t A160786 (* _Leo C. Stein_, Nov 11 2020 *) %o A160786 (Python) %o A160786 # Could be memoized for speedup %o A160786 def numoddpart(n, m=1): %o A160786 """The number of partitions of n into an odd number of parts of size at least m""" %o A160786 if n < m: %o A160786 return 0 %o A160786 elif n == m: %o A160786 return 1 %o A160786 else: %o A160786 # 1 (namely n = n) and all partitions of the form %o A160786 # k + even partitions that start with >= k %o A160786 return 1 + sum([numevenpart(n - k, k) for k in range(m, n//3 + 1)]) %o A160786 def numevenpart(n, m=1): %o A160786 """The number of partitions of n into an even number of parts of size at least m""" %o A160786 if n < 2*m: %o A160786 return 0 %o A160786 elif n == 2*m: %o A160786 return 1 %o A160786 else: %o A160786 return sum([numoddpart(n - k, k) for k in range(m, n//2 + 1)]) %o A160786 [numoddpart(n) for n in range(1, 70, 2)] %o A160786 (Python) %o A160786 # dict to memoize %o A160786 ps = {(0,0): 1} %o A160786 def p(n, k): %o A160786 """Number of partitions of n into exactly k parts""" %o A160786 if (n,k) in ps: return ps[(n,k)] %o A160786 if (n<=0) or (k<=0): return 0 %o A160786 ps[(n,k)] = p(n-k,k) + p(n-1,k-1) %o A160786 return ps[(n,k)] %o A160786 def a(n): return sum([p(2*n+1, k) for k in range(1,2*n+3,2)]) %o A160786 [a(n) for n in range(0,41)] %o A160786 # _Leo C. Stein_, Nov 11 2020 %Y A160786 Partitions with all odd parts are counted by A000009 and ranked by A066208. %Y A160786 This is a bisection of A027193 (odd-length partitions), which is ranked by A026424. %Y A160786 The case of all odd parts is counted by A078408 and ranked by A300272. %Y A160786 The even version is A236913, ranked by A340784. %Y A160786 A multiplicative version is A340102. %Y A160786 These partitions are ranked by A340931. %Y A160786 A047993 counts balanced partitions, ranked by A106529. %Y A160786 A058695 counts partitions of odd numbers, ranked by A300063. %Y A160786 A072233 counts partitions by sum and length. %Y A160786 A236914 counts partition of type OO, ranked by A341448. %Y A160786 A340385 counts partitions with odd length and maximum, ranked by A340386. %Y A160786 Cf. A000700, A168659, A200750, A340604, A340607, A340854, A340855. %K A160786 nonn %O A160786 0,2 %A A160786 Utpal Sarkar (doetoe(AT)gmail.com), May 26 2009