%I #34 Jan 28 2022 15:42:17
%S 1,2,2,4,4,8,8,13,15,22,24,37,40,57,64,89,98,135,149,199,224,292,325,
%T 424,472,601,676,850,950,1191,1329,1643,1845,2258,2524,3082,3442,4158,
%U 4659,5591,6246,7472,8338,9903,11072,13077,14586,17184,19150,22431,25019
%N Number of partitions of n in which each part, with the possible exception of the largest, occurs at least twice.
%C Also, partitions of n in which any two distinct parts differ by at least 2. Example: a(5) = 4 because we have [5], [4,1], [3,1,1] and [1,1,1,1,1].
%D P. A. MacMahon, Combinatory Analysis, Cambridge Univ. Press, London and New York, Vol. 1, 1915 and Vol. 2, 1916; see vol. 2, p 52, Article 298.
%H Vaclav Kotesovec, <a href="/A116931/b116931.txt">Table of n, a(n) for n = 1..20000</a> (terms 1..7500 from Alois P. Heinz)
%H Mingjia Yang, Doron Zeilberger, <a href="https://arxiv.org/abs/1910.08989">Systematic Counting of Restricted Partitions</a>, arXiv:1910.08989 [math.CO], 2019.
%F G.f.: sum(x^k*product(1+x^(2j)/(1-x^j), j=1..k-1)/(1-x^k), k=1..infinity). More generally, the g.f. of partitions of n in which each part, with the possible exception of the largest, occurs at least b times, is sum(x^k*product(1+x^(bj)/(1-x^j), j=1..k-1)/(1-x^k), k=1..infinity). It is also the g.f. of partitions of n in which any two distinct parts differ by at least b.
%F log(a(n)) ~ 2*Pi*sqrt(n)/3. - _Vaclav Kotesovec_, Jan 28 2022
%e a(5) = 4 because we have [5], [3,1,1], [2,1,1,1] and [1,1,1,1,1].
%e q + 2*q^2 + 2*q^3 + 4*q^4 + 4*q^5 + 8*q^6 + 8*q^7 + 13*q^8 + 15*q^9 + ...
%e There are a(9) = 15 partitions of 9 where distinct parts differ by at least 2:
%e 01: [ 1 1 1 1 1 1 1 1 1 ]
%e 02: [ 3 1 1 1 1 1 1 ]
%e 03: [ 3 3 1 1 1 ]
%e 04: [ 3 3 3 ]
%e 05: [ 4 1 1 1 1 1 ]
%e 06: [ 4 4 1 ]
%e 07: [ 5 1 1 1 1 ]
%e 08: [ 5 2 2 ]
%e 09: [ 5 3 1 ]
%e 10: [ 6 1 1 1 ]
%e 11: [ 6 3 ]
%e 12: [ 7 1 1 ]
%e 13: [ 7 2 ]
%e 14: [ 8 1 ]
%e 15: [ 9 ]
%e - _Joerg Arndt_, Jun 09 2013
%p g:=sum(x^k*product(1+x^(2*j)/(1-x^j),j=1..k-1)/(1-x^k),k=1..70): gser:=series(g,x=0,60): seq(coeff(gser,x^n),n=1..54);
%p # second Maple program:
%p b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
%p b(n, i-1) +add(b(n-i*j, i-2), j=1..n/i)))
%p end:
%p a:= n-> b(n, n):
%p seq(a(n), n=1..70); # _Alois P. Heinz_, Nov 04 2012
%t b[n_, i_] := b[n, i] = If[n==0, 1, If[i<1, 0, b[n, i-1] + Sum[b[n-i*j, i-2], {j, 1, n/i}]]]; a[n_] := b[n, n]; Table[a[n], {n, 1, 70}] (* _Jean-François Alcover_, Mar 24 2015, after _Alois P. Heinz_ *)
%o (PARI) {a(n) = if( n<1, 0, polcoeff( sum( k=1, n, x^k / (1 - x^k) * prod( j=1, k-1, 1 + x^(2*j) / (1 - x^j), 1 + x * O(x^(n-k)))), n))} /* _Michael Somos_, Jan 26 2008 */
%Y Cf. A116932, A007690.
%Y Column k=2 of A218698. - _Alois P. Heinz_, Nov 04 2012
%Y Column k=0 of A268193. - _Alois P. Heinz_, Feb 13 2016
%K nonn
%O 1,2
%A _Emeric Deutsch_, Feb 27 2006