Skip to contents

\(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.

Usage

morie_hardy_ramanujan_partitions(n)

Arguments

n

Integer to partition.

Value

A list with partitions, exact (decimal string), asymptotic, ratio, relative_error.

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)"
#>