maths.special_numbers.trimorphic_number

A Trimorphic Number is a number whose cube ends in the same digits as the number itself. For example, 4^3 = 64, which ends in 4.

Reference: https://en.wikipedia.org/wiki/Automorphic_number#Trimorphic_numbers

Functions

is_trimorphic(→ bool)

Checks if a number is a Trimorphic number.

Module Contents

maths.special_numbers.trimorphic_number.is_trimorphic(number: int) bool

Checks if a number is a Trimorphic number.

Parameters:

number – The number to check

Returns:

True if the number is trimorphic, False otherwise

Raises:

ValueError – If the input number is negative

>>> is_trimorphic(0)
True
>>> is_trimorphic(1)
True
>>> is_trimorphic(4)
True
>>> is_trimorphic(5)
True
>>> is_trimorphic(24)
True
>>> is_trimorphic(249)
True
>>> is_trimorphic(2)
False
>>> is_trimorphic(7)
False
>>> is_trimorphic(10)
False
>>> is_trimorphic(-1)
Traceback (most recent call last):
    ...
ValueError: Input must be a non-negative integer