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 A338112 #14 Aug 10 2021 12:17:13 %S A338112 1,3,6,24,120,720,5040,40320,362880,3628800,39916800,479001600, %T A338112 6227020800,87178291200,1307674368000,20922789888000,355687428096000, %U A338112 6402373705728000,121645100408832000,2432902008176640000,51090942171709440000,1124000727777607680000 %N A338112 Least number that is both the sum and product of n distinct positive integers. %C A338112 Each a(n) = n! except that a(2) = 1+2 = 3. For n > 0, only each integer >= A000217(n) is the sum of n distinct positive integers. For the integers that are products of these types, see below. %F A338112 a(n) = A000142(n) for n = 1 and n > 2; a(2) = 3. %F A338112 a(n) = max(A000142(n), A000217(n)). %F A338112 E.g.f.: x*(2 + x - x^2)/(2*(1 - x)). - _Stefano Spezia_, Oct 11 2020 %e A338112 a(1) = 1 because we define sums and products as sum(m) := prod(m) := m for all integers m in this case where these normally-binary operations only have one operand. %e A338112 a(3) = 6 because 6 = 1+2+3 = 1*2*3 (with all the distinct positive integers the same in the sum and the product only for this term and a(1)). %e A338112 a(5) = 120 because 120 = 1+2+3+4+110 (= ... = 22+23+24+25+26) = 1*2*3*4*5. %t A338112 Array[If[# <= 2, (#^2 - #)/2 &[# + 1], #!] &, 22] (* _Michael De Vlieger_, Oct 15 2020 *) %t A338112 With[{nn=30},Rest[CoefficientList[Series[x (2+x-x^2)/(2(1-x)),{x,0,nn}],x] Range[0,nn]!]] (* _Harvey P. Dale_, Aug 10 2021 *) %o A338112 (PARI) a(n) = if(n<1, , if(n==2, 3, n!)) %Y A338112 Cf. A000142, A000217. %Y A338112 Cf. Products of k distinct positive integers: A000027 (k=1), A020725 (k=2), A080257 (k=3), A122181 (k=4). %K A338112 nonn,easy %O A338112 1,2 %A A338112 _Rick L. Shepherd_, Oct 10 2020