OO’s Sequence

Time Limit
4s
Memory Limit
131072KB
Judge Program
Standard
Ratio(Solve/Submit)
14.06%(9/64)
Description:

OO has got a array A of size n ,defined a function f(l,r) represent the number of i (l<=i<=r) , that there's no j(l<=j<=r,j<>i) satisfy ai mod aj=0,now OO want to know

∑i=1->n∑j=i->nf(i,j) mod (10e9+7).

Input:

There are multiple test cases. Please process till EOF.
In each test case:
First line: an integer n(n<=10^5) indicating the size of array
Second line:contain n numbers ai(0i<=10000)

Output:

For each tests: ouput a line contain a number ans.

Sample Input:
5
1 2 3 4 5
Sample Output:
23
Hint:

∑j=i->nf(i,j)表示f(i,j),j从i到n连加

Source:

2015 Multi-University Training Contest 1


Submit