#K38727. Minimum Steps to Reduce N to 1
Minimum Steps to Reduce N to 1
Minimum Steps to Reduce N to 1
You are given an integer N
. Your task is to determine the minimum number of steps required to reduce N
to 1. In each step, you are allowed to divide N
by any prime divisor greater than 1 that evenly divides N
.
This is equivalent to finding the total count of prime factors (with multiplicity) in the prime factorization of N
. Formally, if the prime factorization of N
is \( N = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k} \), then the minimum number of steps required is \( e_1 + e_2 + \cdots + e_k \).
Note: It is guaranteed that N > 1
for all test cases.
inputFormat
The input consists of a single integer N
on a single line, representing the number you need to reduce to 1.
outputFormat
Output a single integer representing the minimum number of steps required to reduce N
to 1 using the allowed operations.
10
2