eolymp
bolt
Try our new interface for solving problems
Problems

GCD-determinant

GCD-determinant

Vasya has recently studied the determinants and now wants to apply them in the field of number theory. He compiled a matrix of \textbf{n}×\textbf{n}, where the \textbf{i}-th row on the site \textbf{j} is the number of \textbf{GCD(i, j)}. For example, for \textbf{n = 3} we obtain the determinant: \includegraphics{https://static.e-olymp.com/content/6b/6b10b496d71c801bf217b94dd2b83f47f2b6edb2.jpg} Now we must calculate the value of Vasya determinant of this matrix, but the task was beyond him, and now you have to solve it. Since the determinant can get quite large, Vasya asks him to count modulo \textbf{500009}. \InputFile The first line of the input file contains a number of tests \textbf{t} (\textbf{1} ≤ \textbf{t} ≤ \textbf{100000}). Each subsequent line contains the number n - the order of the determinant (\textbf{1} ≤ \textbf{n} ≤ \textbf{10^9}). \OutputFile For each test case output the value of the corresponding determinant modulo \textbf{500009}.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
3
2
3
5
Output example #1
1
2
16
Author Evgeniy Sluzhaev