Pagini recente » Cod sursa (job #3293474) | Cod sursa (job #556713) | Cod sursa (job #2809565) | Cod sursa (job #2146801) | Cod sursa (job #450356)
Cod sursa(job #450356)
var 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);
for i:=1 to d-1 do
for j:=1 to c-1 do
if prime(i,j)=true then inc(s);
writeln(s);
close(output);
end.