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
20
Explanation:
hshhsnsnsnsnsmsmmssmdmsnznz
Answered by
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
India Languages,
26 days ago
Political Science,
26 days ago
English,
26 days ago
English,
1 month ago
Math,
1 month ago
English,
9 months ago
Math,
9 months ago