def next_number(number: int) -> int:

    sum_of_digits_squared = 0
    while number:
        # Increased Speed Slightly by checking every 5 digits together.
        sum_of_digits_squared += DIGITS_SQUARED[number % 100000]
        number //= 100000

    return sum_of_digits_squared