Splitting into Primes

Starting from N, repeatedly split every composite into a random divisor pair and report the expected number of rounds until all parts are prime.

Hard8ProbabilityDynamic programmingNumber theoryMathNo attempts yetTime limit1sMemory limit256 MB

Problem

A mass split is an operation on a multiset KK of positive integers. One mass split handles every element of KK at the same time. An element kk that is prime is left alone. An element kk that is not prime is replaced by the two numbers dd and k/dk/d, where dd is a divisor of kk with 1<d<k1 < d < k. Every divisor that meets the condition is equally likely, and each element draws its divisor independently.

Take K={2,10,12,12}K = \{2, 10, 12, 12\} as an example. 2 is prime and stays. The only divisors of 10 strictly between 1 and 10 are 2 and 5, so 10 always becomes {2,5}\{2, 5\}. Each 12 picks one of 2, 3, 4, 6 with probability 1/41/4, which turns it into {2,6}\{2, 6\} or {3,4}\{3, 4\} with probability 1/21/2 each. The first mass split therefore gives {2,2,3,3,4,4,5}\{2, 2, 3, 3, 4, 4, 5\} with probability 0.250.25, {2,2,2,3,4,5,6}\{2, 2, 2, 3, 4, 5, 6\} with probability 0.50.5, and {2,2,2,2,5,6,6}\{2, 2, 2, 2, 5, 6, 6\} with probability 0.250.25. A second mass split applied to the last of those gives {2,2,2,2,2,2,3,3,5}\{2, 2, 2, 2, 2, 2, 3, 3, 5\} and nothing else.

Start from the multiset {N}\{N\}, which holds the single element NN, and repeat the mass split until every element is prime. Compute the expected number of mass splits.

Input

The first line contains the number of test cases TT (1T1041 \le T \le 10^4).

Each of the next TT lines contains one starting value NN (2N10102 \le N \le 10^{10}).

Output

For each test case, print the expected number of mass splits on its own line. Round the value and print exactly six digits after the decimal point. An answer of 2 is printed as 2.000000.