TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

You must have heard of Goldbach's conjecture, a well-known unsolved problem in number theory. It is stated that every even integer greater than 2 can be written as a sum of two prime numbers. Simple, yet extremely hard! No mathematician has been able to prove this conjecture for nearly 300 years. For example:


4 = 2 + 2 14 = 3 + 11

6 = 3 + 3 = 7 + 7

8 = 3 + 5 16 = 3 + 13

10 = 3 + 7 = 5 + 11

 = 5 + 5               18 = 5 + 13

12 = 5 + 7 = 7 + 11

                       ...


Let G(N) be the number of different ways to represent a number of the form 2N as a sum of two prime
numbers. As we have seen in the above examples:

G(i) = 1, 1, 1, 2, 1, 2, 2, 2 for i = 2..9

With the definition of G(N), the Goldbach's conjecture can be stated as follows: G(N) > 0 for all
positive integers N > 1.

Given a number N, your task is to write a program to compute the following sum:


F(N) = G(2) + G(3) + ... + G(N)

Input Format

The input file consists of several data sets. The first line of the input file contains the number of data sets which is a positive integer and is not bigger than 20. The following lines describe the data sets.

Each data set consists of only one line which contains an integer N (3 ≤ N ≤ 500000).

Output Format

For each data set, write in a single line the sum F(N).

Sample Input 1

3
7
4
9

Sample Output 1

8
3
12

Hints

Problem Source

Migrated from old NTUJ.

The ACM-ICPC 2010 Asia Regional Contest, Site Hanoi

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 200