# Python program to find the first odd Abundant or excessive number

### Python program to find the first odd Abundant or excessive number :

In this tutorial, we will learn how to find the first odd Abundant number in python. A number is called Abundant or Excessive number if its sum of all proper divisors is more than the number itself. List of all abundant numbers from 1 to 100 are 12, 18, 20, 24, 30, 36, 40, 42, 48, 54, 56, 60, 66, 70, 72, 78, 80, 84, 88, 90, 96 and 100. In this tutorial, we will learn how to find the first odd Abundant number.
We will use one infinite while loop that will check for all numbers starting from 1. If any number is abundant and also odd , print out the result.

### Python 3 program :

#5
def isAbundant(input_no):
#6
total = 0

#7
for i in range(1,input_no):
#8
if(input_no % i == 0):
#9
total = total + i
if(total > input_no):
return True

#10
if(total > input_no):
return True
else :
return False

#1
no = 1
while(True):
#2
if(isAbundant(no) and no%2 != 0):
#3
print("Odd abundant no : ",no)
break
#4
no += 1

### Explanation :

The commented numbers in the above program denote the step numbers below :

1. Iniitialize one variable no to 1 and run one infinite loop. We are using while loop as infinite. This will check for all numbers starting from 1.
2. Check if the current number is abundant or not. Also check if it is odd or not.
3. If it is odd and abundant , print out the number and break from the infinite loop.
4. Increase the no in the while loop so that we can check for all numbers.
5. isAbundant function takes one number as input and return True if a number is Abundant. Else, it returns False.
6. Set value of total as 0.
7. Run one for loop to run from 1 to the input number .
8. Check if the number is divisible by the current for loop index.
9. Yes means it is a proper divisor. So, add this value to total. If total becomes more than the input number, return True.
10. Finally, check if the total sum is more than input number or not. If yes, return True ,else return False.

### Output :

Odd abundant no :  945

So, the first abundant number is 945 .