finds the aliquot sum of an input integer where the aliquot sum of a number n is defined as the sum of all natural numbers less than n that divide n evenly for example the aliquot sum of 15 is 1 3 5 9 this is a simple on implementation param inputnum a positive integer whose aliquot sum is to be found return the aliquot sum of inputnum if inputnum is positive otherwise raise a valueerror wikipedia explanation https en wikipedia orgwikialiquotsum aliquotsum15 9 aliquotsum6 6 aliquotsum1 traceback most recent call last valueerror input must be positive aliquotsum0 traceback most recent call last valueerror input must be positive aliquotsum1 6 traceback most recent call last valueerror input must be an integer aliquotsum12 16 aliquotsum1 0 aliquotsum19 1 finds the aliquot sum of an input integer where the aliquot sum of a number n is defined as the sum of all natural numbers less than n that divide n evenly for example the aliquot sum of 15 is 1 3 5 9 this is a simple o n implementation param input_num a positive integer whose aliquot sum is to be found return the aliquot sum of input_num if input_num is positive otherwise raise a valueerror wikipedia explanation https en wikipedia org wiki aliquot_sum aliquot_sum 15 9 aliquot_sum 6 6 aliquot_sum 1 traceback most recent call last valueerror input must be positive aliquot_sum 0 traceback most recent call last valueerror input must be positive aliquot_sum 1 6 traceback most recent call last valueerror input must be an integer aliquot_sum 12 16 aliquot_sum 1 0 aliquot_sum 19 1
def aliquot_sum(input_num: int) -> int:
    
    if not isinstance(input_num, int):
        raise ValueError("Input must be an integer")
    if input_num <= 0:
        raise ValueError("Input must be positive")
    return sum(
        divisor for divisor in range(1, input_num // 2 + 1) if input_num % divisor == 0
    )


if __name__ == "__main__":
    import doctest

    doctest.testmod()