automorphic numbers a number n is said to be a automorphic number if the square of n ends in the same digits as n itself examples of automorphic numbers 0 1 5 6 25 76 376 625 9376 90625 https en wikipedia orgwikiautomorphicnumber akshay dubey https github comitsakshaydubey time complexity olog10n doctest normalizewhitespace this functions takes an integer number as input returns true if the number is automorphic isautomorphicnumber1 false isautomorphicnumber0 true isautomorphicnumber5 true isautomorphicnumber6 true isautomorphicnumber7 false isautomorphicnumber25 true isautomorphicnumber259918212890625 true isautomorphicnumber259918212890636 false isautomorphicnumber740081787109376 true isautomorphicnumber5 0 traceback most recent call last typeerror input value of number5 0 must be an integer akshay dubey https github com itsakshaydubey time complexity o log10n doctest normalize_whitespace this functions takes an integer number as input returns true if the number is automorphic is_automorphic_number 1 false is_automorphic_number 0 true is_automorphic_number 5 true is_automorphic_number 6 true is_automorphic_number 7 false is_automorphic_number 25 true is_automorphic_number 259918212890625 true is_automorphic_number 259918212890636 false is_automorphic_number 740081787109376 true is_automorphic_number 5 0 traceback most recent call last typeerror input value of number 5 0 must be an integer
def is_automorphic_number(number: int) -> bool:
    
    if not isinstance(number, int):
        msg = f"Input value of [number={number}] must be an integer"
        raise TypeError(msg)
    if number < 0:
        return False
    number_square = number * number
    while number > 0:
        if number % 10 != number_square % 10:
            return False
        number //= 10
        number_square //= 10
    return True


if __name__ == "__main__":
    import doctest

    doctest.testmod()