Pagini recente » Cod sursa (job #2444709) | Cod sursa (job #2106432) | Cod sursa (job #1410565) | Cod sursa (job #2682881) | Cod sursa (job #1448674)
#include <fstream>
#include <bitset>
using namespace std;
ifstream f("ssnd.in");
ofstream g("ssnd.out");
int m,t,exp,poz;
int p[100000];
bitset <1000005> w;
int main()
{
f>>t;
p[1]=2; m=1; long long i,j,suma,n,nr,prod;
for(i=3;i<=1000000;i+=2)
if(!w[i])
{ p[++m]=i;
for(j=i*i;j<=1000000;j+=(i<<1)) w[j]=1;}
while(t--)
{
f>>n; poz=1; suma=1; nr=1;
while(n>1) {exp=1; prod=p[poz]%9973; while(n%p[poz]==0) {exp++; n/=p[poz]; prod=prod*p[poz]%9973;} if(exp>1) {nr*=exp; suma=suma*((prod-1)/(p[poz]-1))%9973;} poz++;}
g<<nr<<" "<<suma<<'\n';
}
g.close();
return 0;
}