Pagini recente » Cod sursa (job #2722471) | Cod sursa (job #2520760) | Cod sursa (job #3154412) | Cod sursa (job #259446) | Cod sursa (job #451003)
Cod sursa(job #451003)
var max,min,c,s,d,i,j:longint;
function prime(a,b:longint):boolean;
var k,i:longint;
begin
k:=trunc(sqrt(a));
prime:=true;
for i:=2 to k do
if a mod i=0 then
begin
if b mod i=0 then
begin
prime:=false;
break;
end;
a:=a div i;
while a mod i=0 do
a:=a div i;
end;
if (a<>1) and (b mod a=0) then prime:=false;
end;
begin
assign(input,'mins.in');
assign(output,'mins.out');
reset(input);
rewrite(output);
readln(c,d);
if c<d then
begin
min:=c-1;
max:=d-1;
end
else
begin
min:=d-1;
max:=c-1;
end;
s:=0;
for i:=2 to min do
for j:=1 to i-1 do
if prime(i,j)=true then inc(s);
s:=s*2;
for i:=min+1 to max do
for j:=1 to min do
if prime(i,j)=true then inc(s);
writeln(s+1);
close(output);
end.