CoprCopr

4.1

51 votes
Approved, Easy, Math, Number Theory, Open, Primality test, Sieve
Problem

Link to Russian translation of problem

You are given positive integer N. How many unordered pairs of integers from 1 to N are coprime?

Input
The first line contains one integer T denoting the number of test cases. The following T lines contain one number each - N and describe each test case.

Output
For each test case output one integer per line - answer for the question.

Constraints

  • N <= 107
  • T <= 10
Sample Input
2
3
4
Sample Output
4
6

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?