maths.sylvester_sequence

Calculates the nth number in Sylvester’s sequence

Source:

https://en.wikipedia.org/wiki/Sylvester%27s_sequence

Functions

sylvester(→ int)

Module Contents

maths.sylvester_sequence.sylvester(number: int) int
Parameters:

number – nth number to calculate in the sequence

Returns:

the nth number in Sylvester’s sequence

>>> sylvester(8)
113423713055421844361000443
>>> sylvester(-1)
Traceback (most recent call last):
    ...
ValueError: The input value of [n=-1] has to be > 0
>>> sylvester(8.0)
Traceback (most recent call last):
    ...
AssertionError: The input value of [n=8.0] is not an integer