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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.4, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions