382 传统题

[CF2289F] 平方乘积三元组 (Problem from Malinovka)

时间限制
5000ms
内存限制
256MiB
登顶 / 尝试
1/ 1
难度
8
    上传者 标签CodeforcesDiv. 2数论容斥原理整除分块

[CF2289F] 平方乘积三元组 (Problem from Malinovka)

Problem Statement

Given an integer nn, find the number of ordered triples of integers (x,y,z)(x, y, z) such that 1≤x,y,z≤n1 \le x, y, z \le n and the product x⋅y⋅zx \cdot y \cdot z is a perfect square.

Input

First line: tt (1≤t≤1041 \le t \le 10^4). Each test case: one integer nn (1≤n≤1061 \le n \le 10^6). Sum of nn over all test cases ≤106\le 10^6.

Output

For each test case, output the number of suitable triples.

样例

5
1
2
3
4
999990
1
4
7
20
141799145052