
Hardy-Ramanujan asymptotics for the partition function
Source:R/analytic_combinatorics_native.R
morie_hardy_ramanujan_partitions.Rd\(p(n) \sim \exp(\pi\sqrt{2n/3}) / (4n\sqrt{3})\), held against \(p(n)\) computed exactly by Euler's pentagonal recurrence in arbitrary precision. Convergence is famously slow – the relative error decays like \(n^{-1/2}\) and is still 4.6 per cent at \(n = 100\) – and the point of returning both is that the formula's fame should not be mistaken for accuracy.
Examples
morie_hardy_ramanujan_partitions(n = 5L)
#> $partitions
#> [1] 7
#>
#> $exact
#> [1] "7"
#>
#> $estimate
#> [1] 8.941459
#>
#> $asymptotic
#> [1] 8.941459
#>
#> $ratio
#> [1] 1.277351
#>
#> $relative_error
#> [1] 0.2773513
#>
#> $n
#> [1] 5
#>
#> $method
#> [1] "Hardy-Ramanujan asymptotic (1918)"
#>