2
$\begingroup$

Are there in any relatively efficient known algorithms to compute the partition function $P(n)$ for a given $n$? What's known about the complexity class of this problem as a function of $n$?

Perhaps I'm missing something trivial here, but other than listing some recurrent definitions of this function and some of their asymptotics, I don't see this precise information (complexity class, and known algorithms with their runtime/space complexity) in either of these articles:

喜欢算法和数学
39.2k4 gold badges35 silver badges96 bronze badges
asked Apr 13, 2020 at 16:03
$\endgroup$
3
  • 1
    $\begingroup$ The Wikipedia article summarizes all known information about this question. $\endgroup$ Commented Apr 13, 2020 at 16:08
  • 2
    $\begingroup$ Check last paragraph of the second article: "Techniques for implementing the Hardy–Ramanujan–Rademacher formula efficiently on a computer are discussed by Johansson (2012), who shows that {\displaystyle p(n)}p(n) can be computed in time {\displaystyle O(n^{1/2+\varepsilon })}{\displaystyle O(n^{1/2+\varepsilon })} for any {\displaystyle \varepsilon >0}\varepsilon >0. This is near-optimal in that it matches the number of digits of the result.[19] ..." $\endgroup$ Commented Apr 13, 2020 at 16:19
  • $\begingroup$ Ah +1 thanks @YuvalFilmus - I had originally checked the first link, and then read quickly through the second one but didn't get any search hits for the keywords 'algorithm', 'complexity', 'runtime' or 'class' in either of them. Reading the 2nd one all the way to the end would've helped :). So it's in $P$ (assuming e.g. input size = $n$) then? $\endgroup$ Commented Apr 13, 2020 at 16:23

1 Answer 1

4
$\begingroup$

Johansson gave a nearly linear time algorithm (in terms of the output size!) in his paper Efficient implementation of the Hardy-Ramanujan-Rademacher formula. This work is mentioned at the very end of the Wikipedia article on the partition function.

answered Apr 14, 2020 at 9:38
$\endgroup$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.