-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path13279.cpp
More file actions
60 lines (56 loc) · 1.19 KB
/
13279.cpp
File metadata and controls
60 lines (56 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <bits/stdc++.h>
using namespace std;
#define pn 5000001
#define p 100000007
#define ll long long
vector<ll> prime;
void sieve()
{
vector<bool> isPrime(pn+1,true);
isPrime[0] = isPrime[1] =false;
for(int i=2; i <= pn ;i++)
{
if(isPrime[i] ==true)
{
prime.push_back(i);
}
for(int j=0; i * prime[j]<= pn;j++)
{
isPrime[i*prime[j]] = false;
if (i % prime[j] == 0)
break;
}
}
}
ll divisor(ll n)
{
ll ret =1;
for(int i=0;prime[i] <= n && i < prime.size();i++)
{
ll ex = 0;
ll num = prime[i];
ll nn =n;
while(num<=n)
{
ll np = nn/prime[i];
ex += ((((np-1)*np/2)%p * num ) %p +((n%num+1) *np)%p) %p;
ex %= p;
nn /= prime[i];
num =num *prime[i];
}
ret = (ret * (ex +1 )) %p;
}
return ret;
}
int main()
{
//freopen("in.txt", "rt", stdin);
//freopen("out.txt", "w+t", stdout);
ll n;
sieve();
while(scanf("%lld",&n) && n)
{
cout<<divisor(n)<<endl;
}
return 0;
}