#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
vector<ll>d[100005];
void divisors()
{
ll i, j;
for(i=1;i<100002;i++)
{
for(j=i;j<=100002;j+=i)
d[j].push_back(i);
}
}
int main()
{
ll a, b, c, f, n, m, i, j, k;
divisors();
while(cin >> n)
{
for(j=1;j<=n;j++)
{
cin >> a >> b >> m;
while(a%m != 0)
{
a++;
}
c = f = 0;
for(i=a;i<=b;i+=m)
{
c += d[i].size();
for(k=0;k<d[i].size();k++)
{
f+= d[i][k];
}
}
cout << c << " " << f << endl;
}
}
return 0;
}
Comments
Post a Comment