Computer Science, asked by narasimhasira, 1 month ago

Sara is solving a math problem in which she has given an integer N and her task is to find the number of operations required to convert N into 1.  Where in one operation you replace the number with its second-highest divisor. Input User Task:  Since this will be a functional problem, you don't have to take input. You just have to complete the function DivisorProblem() that takes integer N as argument.  Constraints:-  1 ​

Answers

Answered by chandigarh2690
20

Explanation:

hshhsnsnsnsnsmsmmssmdmsnznz

Answered by althumon1995
14

Answer:

N=int(input("Enter the divisor: "));

print(N)

step =0

while(N!=1):

   if (N%2)==0:

       N=N/2

       step=step+1

   elif (N%3)==0:

       N=N/3

       step=step+1

   elif (N%5)==0:

       N=N/5

       step=step+1

   elif (N%7)==0:

       N=N/7

       step=step+1

   else:

       N=1

       step=step+1

print(step)    

Explanation:

Similar questions