Pagini recente » Cod sursa (job #2682044) | Cod sursa (job #1174725) | Cod sursa (job #173045) | Cod sursa (job #1782684) | Cod sursa (job #609007)
Cod sursa(job #609007)
Program suma_divizorilor;
const md=9901;
var a,b,i,j,d,s,x:longint;
p:array [1..10000] of boolean;
c:array [1..2000] of longint;
fi,fo:text;
function pow(a,b:int64):int64;
begin
pow:=1;
while b>0 do
if b mod 2=0 then begin
a:=a*a;
a:=a mod md;
b:=b div 2;
end
else begin
pow:=pow*a;
pow:=pow mod md;
dec(b);
end;
end;
begin
assign(fi,'sumdiv.in');
assign(fo,'sumdiv.out');
reset(fi);
rewrite(fo);
readln(fi,a,b);
for i:=2 to 10000 do
if not p[i] then begin
for j:=2 to 10000 div i do
p[i*j]:=true;
inc(x);
c[x]:=i;
end;
i:=1; s:=1;
if b>0 then begin
while (i<x) and (a>1) and (c[i]<=trunc(sqrt(a))) do
if a mod c[i]<>0 then inc(i)
else begin
d:=0;
repeat
inc(d);
a:=a div c[i];
until (a=1) or (a mod c[i]<>0);
d:=d*b;
s:=s*(pow(c[i],d+1)-1); s:=s mod md;
s:=s*(pow(c[i]-1,md-2)); s:=s mod md;
end;
if a>1 then begin
s:=s*((a+1) mod md);
s:=s mod md;
end;
end;
write(fo,s);
close(fo);
end.