Ridbit begins with an integer n. In one action, he can perform one of the accompanying tasks: partition n by one of its appropriate divisors, or take away 1 from n in case n is more prominent than 1. An appropriate divisor is a divisor of a number, barring itself. For instance, 1, 2, 4, 5, and 10 are
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
Ridbit begins with an integer n.
In one action, he can perform one of the accompanying tasks:
partition n by one of its appropriate divisors, or
take away 1 from n in case n is more prominent than 1.
An appropriate divisor is a divisor of a number, barring itself. For instance, 1, 2, 4, 5, and 10 are appropriate divisors of 20, however 20 itself isn't.
What is the base number of moves Ridbit is needed to make to decrease n to 1?
Input
The principal line contains a solitary integer t (1≤t≤1000) — the number of experiments.
The main line of each experiment contains a solitary integer n (1≤n≤109).
Output
For each experiment, output the base number of moves needed to lessen n to 1.
Step by step
Solved in 4 steps with 1 images