maths.special_numbers.polygonal_numbers ======================================= .. py:module:: maths.special_numbers.polygonal_numbers Functions --------- .. autoapisummary:: maths.special_numbers.polygonal_numbers.polygonal_num Module Contents --------------- .. py:function:: polygonal_num(num: int, sides: int) -> int Returns the `num`th `sides`-gonal number. It is assumed that `num` >= 0 and `sides` >= 3 (see for reference https://en.wikipedia.org/wiki/Polygonal_number). >>> polygonal_num(0, 3) 0 >>> polygonal_num(3, 3) 6 >>> polygonal_num(5, 4) 25 >>> polygonal_num(2, 5) 5 >>> polygonal_num(-1, 0) Traceback (most recent call last): ... ValueError: Invalid input: num must be >= 0 and sides must be >= 3. >>> polygonal_num(0, 2) Traceback (most recent call last): ... ValueError: Invalid input: num must be >= 0 and sides must be >= 3.