SPOILER F: - - - - - - - - - - - - - - - - - - - - - - - - - - - Solution: Bell Numbers B_n is the number of set partitions of the n-set. Example: There are 5 partitions of the set {1, 2, 3}. {{1,2,3}}, {{1,2},{3}}, {{1,3},{2}}, {{1},{2,3}}, {{1},{2},{3}}. The following difference relation is the easiest way to compute the first n terms. 1 2 5 15 52 203 ... 1 3 10 37 151 2 7 27 114 5 20 87 15 67 52 ... Relations: B_n+1 = Sum_{i=0..n} B_i * BinomialCoefficient(n,i) // Recursion B_n = S(n,0) + S(n,1) + ... + S(n,n) // Sum of the Stirling 2nd Numbers exp(exp(x) - 1) = Sum_{n>=0} B_n * x^n / n! // Generating Function References: [C1] = L. Comtet, { Advanced Combinatorics}, Reidel, Dordrecht, Holland, 1974. [RCI] = J. Riordan, { Combinatorial Identities}, Wiley, NY, 1968.