cp's OEIS Frontend

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.

A024786 Number of 2's in all partitions of n.

This page as a plain text file.
%I A024786 #146 Mar 28 2025 11:49:54
%S A024786 0,1,1,3,4,8,11,19,26,41,56,83,112,160,213,295,389,526,686,911,1176,
%T A024786 1538,1968,2540,3223,4115,5181,6551,8191,10269,12756,15873,19598,
%U A024786 24222,29741,36532,44624,54509,66261,80524,97446,117862,142029,171036,205290,246211
%N A024786 Number of 2's in all partitions of n.
%C A024786 Also number of partitions of n-1 with a distinguished part different from all the others. [Comment corrected by _Emeric Deutsch_, Aug 13 2008]
%C A024786 In general the number of times that j appears in the partitions of n equals Sum_{k<n, k = n (mod j)} P(k). In particular this gives a formula for a(n), A024787, ..., A024794, for j = 2,...,10; it generalizes the formula given for A000070 for j=1. - Jose Luis Arregui (arregui(AT)posta.unizar.es), Apr 05 2002
%C A024786 Equals row sums of triangle A173238. - _Gary W. Adamson_, Feb 13 2010
%C A024786 The sums of two successive terms give A000070. - _Omar E. Pol_, Jul 12 2012
%C A024786 a(n) is also the difference between the sum of second largest and the sum of third largest elements in all partitions of n. More generally, the number of occurrences of k in all partitions of n equals the difference between the sum of k-th largest and the sum of (k+1)st largest elements in all partitions of n. And more generally, the sum of the number of occurrences of k, k+1, k+2..k+m in all partitions of n equals the difference between the sum of k-th largest and the sum of (k+m+1)st largest elements in all partitions of n. - _Omar E. Pol_, Oct 25 2012
%C A024786 Number of singletons in all partitions of n-1. A singleton in a partition is a part that occurs exactly once. Example: a(5) = 4 because in the partitions of 4, namely [1,1,1,1], [1,1,2'], [2,2], [1',3'], [4'] we have 4 singletons (marked by '). - _Emeric Deutsch_, Sep 12 2016
%C A024786 a(n) is also the number of non-isomorphic vertex-transitive cover graphs of lattice quotients of essential lattice congruences of the weak order on the symmetric group S_{n-1}. See Table 1 in the Hoang/Mütze reference in the Links section. - _Torsten Muetze_, Nov 28 2019
%C A024786 Assuming a partition is in weakly decreasing order, a(n) is also the number of times -1 occurs in the differences of the partitions of n+1. - _George Beck_, Mar 28 2023
%D A024786 J. Riordan, Combinatorial Identities, Wiley, 1968, p. 184.
%H A024786 Alois P. Heinz and Vaclav Kotesovec, <a href="/A024786/b024786.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Alois P. Heinz)
%H A024786 David Benson, Radha Kessar, and Markus Linckelmann, <a href="https://arxiv.org/abs/2204.09970">Hochschild cohomology of symmetric groups in low degrees</a>, arXiv:2204.09970 [math.GR], 2022.
%H A024786 Philip Cuthbertson, <a href="https://math.colgate.edu/~integers/z28/z28.pdf">Fixed hooks in arbitrary columns of partitions</a>, Integers (2025) Vol. 25, Art. No. A28. See p. 3.
%H A024786 Manosij Ghosh Dastidar and Sourav Sen Gupta, <a href="http://arxiv.org/abs/1111.0094">Generalization of a few results in Integer Partitions</a>, arXiv preprint arXiv:1111.0094 [cs.DM], 2011.
%H A024786 Emeric Deutsch et al., <a href="https://www.mat.uniroma2.it/~tauraso/AMM/AMM11237.pdf">Problem 11237</a>, Amer. Math. Monthly, 115 (No. 7, 2008), 666-667. [From _Emeric Deutsch_, Aug 13 2008]
%H A024786 Hung Phuc Hoang and Torsten Mütze, <a href="https://arxiv.org/abs/1911.12078">Combinatorial generation via permutation languages. II. Lattice congruences</a>, arXiv:1911.12078 [math.CO], 2019.
%H A024786 Joseph Vandehey, <a href="https://math.colgate.edu/~integers/a18Proc23/a18Proc23.pdf">Digital problems in the theory of partitions</a>, Integers (2024) Vol. 24A, Art. No. A18. See p. 3.
%F A024786 a(n) = Sum_{k=1..floor(n/2)} A000041(n-2k). - _Christian G. Bower_, Jun 22 2000
%F A024786 a(n) = Sum_{k<n, k = n (mod 2)} P(k), P(k) = number of partitions of k as in A000041, P(0) = 1. - Jose Luis Arregui (arregui(AT)posta.unizar.es), Apr 05 2002
%F A024786 G.f.: (x^2/((1-x)*(1-x^2)^2))*Product_{j>=3} 1/(1-x^j) from Riordan reference second term, last eq.
%F A024786 a(n) = A006128(n-1) - A194452(n-1). - _Omar E. Pol_, Nov 20 2011
%F A024786 a(n) = A181187(n,2) - A181187(n,3). - _Omar E. Pol_, Oct 25 2012
%F A024786 a(n) ~ exp(Pi*sqrt(2*n/3)) / (2^(5/2) * Pi * sqrt(n)) * (1 - 25*Pi/(24*sqrt(6*n)) + (25/48 + 433*Pi^2/6912)/n). - _Vaclav Kotesovec_, Mar 07 2016, extended Nov 05 2016
%F A024786 a(n) = Sum_{k} k * A116595(n-1,k). - _Emeric Deutsch_, Sep 12 2016
%F A024786 G.f.: x^2/((1 - x)*(1 - x^2)) * Sum_{n >= 0} x^(2*n)/( Product_{k = 1..n} 1 - x^k ); that is, convolution of A004526 (partitions into 2 parts, or, modulo offset differences, partitions into parts <= 2) and A002865 (partitions into parts >= 2). - _Peter Bala_, Jan 17 2021
%e A024786 From _Omar E. Pol_, Oct 25 2012: (Start)
%e A024786 For n = 7 we have:
%e A024786 --------------------------------------
%e A024786 .                             Number
%e A024786 Partitions of 7               of 2's
%e A024786 --------------------------------------
%e A024786 7 .............................. 0
%e A024786 4 + 3 .......................... 0
%e A024786 5 + 2 .......................... 1
%e A024786 3 + 2 + 2 ...................... 2
%e A024786 6 + 1 .......................... 0
%e A024786 3 + 3 + 1 ...................... 0
%e A024786 4 + 2 + 1 ...................... 1
%e A024786 2 + 2 + 2 + 1 .................. 3
%e A024786 5 + 1 + 1 ...................... 0
%e A024786 3 + 2 + 1 + 1 .................. 1
%e A024786 4 + 1 + 1 + 1 .................. 0
%e A024786 2 + 2 + 1 + 1 + 1 .............. 2
%e A024786 3 + 1 + 1 + 1 + 1 .............. 0
%e A024786 2 + 1 + 1 + 1 + 1 + 1 .......... 1
%e A024786 1 + 1 + 1 + 1 + 1 + 1 + 1 ...... 0
%e A024786 ------------------------------------
%e A024786 .  24 - 13 =                    11
%e A024786 .
%e A024786 The difference between the sum of the second column and the sum of the third column of the set of partitions of 7 is 24 - 13 = 11 and equals the number of 2's in all partitions of 7, so a(7) = 11.
%e A024786 (End)
%p A024786 b:= proc(n, i) option remember; local f, g;
%p A024786       if n=0 or i=1 then [1, 0]
%p A024786     else f:= b(n, i-1); g:= `if`(i>n, [0$2], b(n-i, i));
%p A024786          [f[1]+g[1], f[2]+g[2]+`if`(i=2, g[1], 0)]
%p A024786       fi
%p A024786     end:
%p A024786 a:= n-> b(n, n)[2]:
%p A024786 seq(a(n), n=1..50);  # _Alois P. Heinz_, May 18 2012
%t A024786 Table[ Count[ Flatten[ IntegerPartitions[n]], 2], {n, 1, 50} ]
%t A024786 (* Second program: *)
%t A024786 b[n_, i_] := b[n, i] = Module[{f, g}, If[n==0 || i==1, {1, 0}, f = b[n, i - 1]; g = If[i>n, {0, 0}, b[n-i, i]]; {f[[1]] + g[[1]], f[[2]] + g[[2]] + If[i == 2, g[[1]], 0]}]]; a[n_] := b[n, n][[2]]; Table[a[n], {n, 1, 50}] (* _Jean-François Alcover_, Sep 22 2015, after _Alois P. Heinz_ *)
%t A024786 Join[{0}, (1/((1 - x^2) QPochhammer[x]) + O[x]^50)[[3]]] (* _Vladimir Reshetnikov_, Nov 22 2016 *)
%t A024786 Table[Sum[(1 + (-1)^k)/2 * PartitionsP[n-k], {k, 2, n}], {n, 1, 50}] (* _Vaclav Kotesovec_, Aug 27 2017 *)
%o A024786 (Python)
%o A024786 from sympy import npartitions
%o A024786 def A024786(n): return sum(npartitions(n-(k<<1)) for k in range(1,(n>>1)+1)) # _Chai Wah Wu_, Oct 25 2023
%Y A024786 Cf. A066633, A024787, A024788, A024789, A024790, A024791, A024792, A024793, A024794, A173238.
%Y A024786 Column 2 of A060244.
%Y A024786 First differences of A000097.
%K A024786 nonn
%O A024786 1,4
%A A024786 _Clark Kimberling_