All submissions for this problem are available.
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
There are N integers X1, X2, ..., XN.
Let's define Yi,j = Xi × Xj mod 359999.
How many integer 6-tuples (a, b, c, d, e, f) are there such that:
- 1 ≤ a, b, c, d, e, f ≤ N
- gcd(Ya, b, Yc, d, Ye, f) = 1
We define gcd(0, 0) = 0.
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer N.
The second line contains N integers separated by single spaces: X1, X2, ..., XN.
For each test case, output a single line containing the answer. Since the answer can be very large, only output it modulo 109 + 7.
- 1 ≤ T ≤ 3
- 1 ≤ Xi ≤ 106
SubtasksSubtask #1 (47 points):
- 1 ≤ N ≤ 103
- 1 ≤ N ≤ 106
- The sum of the Ns is ≤ 106
Input: 1 3 300 3000 30000 Output: 234
|Tags||fft, hard, jan17, kevinsogo, mobius_function, number-theory, primitive-root|
|Time Limit:||6 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.