// Arup Guha
// 7/28/2010
// Solution to BHCSI contest problem Arup's Pseudoprimes

import java.util.*;
import java.io.*;

public class primesum {
	
	final static int MAX = 1000000;
	
	public static void main(String[] args) throws Exception {
		
		// Array used for "pseudo-sieve"
		/* Note: This array only needs to be size 4374984 terms long
		 *       because the millionth Arup pseudoprime is 4374983.
		 *       But, when first writing this solution, it's hard to
		 *       know exactly how big this array needs to be. A bit of
		 *       experimentation is expected to determine that value.
		 *       I left mine at 50,000,000 to show that the fake
		 *       sieve (and even the real one), can run quickly for
		 *       an array of this size.
		 */
		boolean[] isPrime = new boolean[50000000];
		
		// Initialize choices.
		isPrime[0] = isPrime[1] = false;
		for (int i=2; i<isPrime.length; i++)
			isPrime[i] = true;
			
		// Only mark out numbers as being "composite" only if
		// 2, 3 5 or 7 divide into them.
		for (int i=2; i<=7; i++) {
			if (isPrime[i])
				for (int j=2*i; j<isPrime.length; j+=i)
					isPrime[j] = false;
		}
		
		// Array to store all sums. Without storing them, we could spend too much
		// time recalculating large cases. Imagine summing the first 999,000 terms
		// and then being asked to sum the first 985,999 terms.
		double[] allsums = new double[MAX+1];
		allsums[0] = 0;
		
		int numTerms = 1;
		double sum = 0;
		
		// Loop through our sieve array, picking off each prime.
		for (int i=1; i<isPrime.length && numTerms<allsums.length; i++) {
			
			// This number(i) is prime, so add the appropriate term to our sum.
			if (isPrime[i]) {
				
				// Add this term.
				sum += 1.0/i;
				
				// Store this sum!
				allsums[numTerms] = sum;
				numTerms++;
			}
		}
		
		// Now that we've solved the problem, just open the file, read the
		// questions and immediately output the answers =)
		Scanner fin = new Scanner(new File("primesum.in"));
		int numCases = fin.nextInt();
		
		for (int i=0; i<numCases; i++) {
			int k = fin.nextInt();
			System.out.println("Sum of "+k+" terms is approximately "+allsums[k]+".");
		}
		fin.close();
	}
}