Error in my derivation of $\binom{2n-1}{n}$ as number of partitions of $n$

Does a formula for the number of partitions of an integer exist? Given that this sequence is in the OEIS (https://oeis.org/A000041) I would guess not.

However I have an intuitive way of counting them, which apparently must be wrong.

For any integer n, we can write the integer as an equation $x_1 + x_2 + ... + x_n = n$ where $x_1, x_2, ..., x_n$ are integers. For example we could have $x_1=n-1, x_2=1, x_3=...=x_n=0$, or $x_1=n-3, x_2=1, x_3=2, x_4=...=x_n=0$, or $x_1=n, x_2=...=x_n=0$, and so on.

The number of solutions to this equation can be determined with stars and bars method of combinatorics to be $2n-1 \choose n$, which equals $\frac{(2n-1)!}{n! (n-1)!}$. Would this not serve as a general formula for the number of partitions of the integer $n$?


There isn't a closed formula for the partitions of an integer, even though Ramanujan created a formula that approximates the result:

$$p(n) \sim \frac{\exp\left(\pi \sqrt{\frac{3n}{2}} \right)}{4n\sqrt{3}} $$

But this approximation only works when n is very large. To calculate the partitions of an integer, computations often rely on the partitions of the previous integers. This interactive document that you can find on the Wikipedia page of partitions is the one that helped me understand better how we compute partitions.