For this Question: You are given Q queries. Each query consists of a single number N. You can perform any one of the  2 operations in a single move:
1: If we take 2 integers a and b where, N=a*b, (a and b are not equal to 1), then we can change N=max(a,b)
2: Decrease the value of N by 1 .
For each query determine the minimum number of moves required to reduce the value of N to 0.The first line contains the integer Q. 
The next Q lines each contain an integer, N.
1 <= Q <= 1000
1 <= N <= 1000000Output Q lines. Each line containing the minimum number of moves required to reduce the value of N  to 0.Sample Input
2
3
4
Sample Output
3
3
Explanation
For test case 1, We only have one option that gives the minimum number of moves. 
Follow  3-> 2 -> 1 ->0 . Hence, 3 moves.
For the case 2, we can either go 4 -> 3 -> 2 -> 1 -> 0 or  4-> 2 -> 1 ->0 . The 2nd option is more optimal. Hence, 3 moves., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) {


		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
		int n = 1000000;
		int dp[] = new int[n+1];
		for(int i=0; i<n; i++){

			dp[i] = Integer.MAX_VALUE;
		}

		dp[0] = 0;
		dp[1] = 1;
		for(int i=2; i<n; i++){
			dp[i] = Math.min(dp[i], 1+dp[i-1]);
			for(int j=2; j<=i && i*j<n; j++){
				dp[i*j] = Math.min(dp[i*j], 1+dp[i]);
			}
		}

		while(q-- > 0){
			int x = sc.nextInt();
			System.out.println(dp[x]);
		}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?