DETER - Find The Determinant
In this problem you have to calculate the determinant of an N x N matrix whose entries are given by m[i][j] = gcd(i,j), 1 ≤ i,j ≤ N.
Here gcd(i,j) denotes the greatest common divisor of i and j.
As the determinant D can grow very large, you have to print D%1000003.
First line of input consists of a single integer containing the number of test cases T ( equal to around 500000), each of the following T lines contain an integer N the size of the matrix. N lies between 1 and 2000000 ( both inclusive ).
One line corresponding to each test case containing the determinant modulo 1000003 for the corresponding test case.
Input: 3 1 3 5 Output: 1 2 16
This problem is moved to tutorial section because a similar (almost the same) problem MSE08H is available in the classical section.
In which book? 1st, 2nd ...?