maths.special_numbers.proth_number¶
Calculate the nth Proth number Source:
Attributes¶
Functions¶
|
|
|
Module Contents¶
- maths.special_numbers.proth_number.is_proth_number(number: int) bool ¶
- Parameters:
number – positive integer number
- Returns:
true if number is a Proth number, false otherwise
>>> is_proth_number(1) False >>> is_proth_number(2) False >>> is_proth_number(3) True >>> is_proth_number(4) False >>> is_proth_number(5) True >>> is_proth_number(34) False >>> is_proth_number(-1) Traceback (most recent call last): ... ValueError: Input value of [number=-1] must be > 0 >>> is_proth_number(6.0) Traceback (most recent call last): ... TypeError: Input value of [number=6.0] must be an integer
- maths.special_numbers.proth_number.proth(number: int) int ¶
- Parameters:
number – nth number to calculate in the sequence
- Returns:
the nth number in Proth number
Note: indexing starts at 1 i.e. proth(1) gives the first Proth number of 3 >>> proth(6) 25 >>> proth(0) Traceback (most recent call last):
…
ValueError: Input value of [number=0] must be > 0 >>> proth(-1) Traceback (most recent call last):
…
ValueError: Input value of [number=-1] must be > 0 >>> proth(6.0) Traceback (most recent call last):
…
TypeError: Input value of [number=6.0] must be an integer
- maths.special_numbers.proth_number.value = 0¶