maths.juggler_sequence¶
== Juggler Sequence == Juggler sequence start with any positive integer n. The next term is obtained as follows:
If n term is even, the next term is floor value of square root of n . If n is odd, the next term is floor value of 3 time the square root of n.
https://en.wikipedia.org/wiki/Juggler_sequence
Functions¶
|
Module Contents¶
- maths.juggler_sequence.juggler_sequence(number: int) list[int] ¶
>>> juggler_sequence(0) Traceback (most recent call last): ... ValueError: Input value of [number=0] must be a positive integer >>> juggler_sequence(1) [1] >>> juggler_sequence(2) [2, 1] >>> juggler_sequence(3) [3, 5, 11, 36, 6, 2, 1] >>> juggler_sequence(5) [5, 11, 36, 6, 2, 1] >>> juggler_sequence(10) [10, 3, 5, 11, 36, 6, 2, 1] >>> juggler_sequence(25) [25, 125, 1397, 52214, 228, 15, 58, 7, 18, 4, 2, 1] >>> juggler_sequence(6.0) Traceback (most recent call last): ... TypeError: Input value of [number=6.0] must be an integer >>> juggler_sequence(-1) Traceback (most recent call last): ... ValueError: Input value of [number=-1] must be a positive integer