#write a function divisor that has one parameter #positive integer and finds and returns #number of PROPER divisors and sum of PROPER #divisors - MUST USE LOOP FOR #write a program that reads a sequence of #positive integers, first zero or negative will #terminate the input. For each number the program #will check weather the number is PRIME or NOT #and print appropriate message #example: 8, find all divisors of 8 #1, 2, 4, and 8 ARE divisors of number 8 #8%1=0, 8%2=0, 8%4=0 and 8%8=0 #PROPER DIVISOR is a divisor that is smaller than #the number itself #Example: 1, 2, and 4 are PROPER divisors of #number 8 #Proper divisors they are divisors that don't #include the number itself #Prime number - the number that has only 2 #divisors - 1 and the number itself #BY DEFINITION 1 is NOT PRIME def divisor(num): sum_div=0 count_div=0 for i in range(1, num): if(num%i==0): sum_div=sum_div+i count_div=count_div+1 return sum_div, count_div def main(): num=int(input("enter positive int ")) count_pos_inputs=0 while(num>0): count_pos_inputs=count_pos_inputs+1 sum_div,count_div = divisor(num) print("sum of proper divisors is ", sum_div) print("number of proper divisors is ", count_div) if(num!=1 and count_div==1): print(num, "IS PRIME") else: print(num, "IS NOT PRIME") num=int(input("enter positive int ")) if(count_pos_inputs==0): print("Empty input") else: print("we processed", count_pos_inputs, "pos ints") main()