blob: 0dec65ebaceac691ff3d5988f3c8282598a09256 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
uses clib;
var
a, b: int64;
i, j: int32;
p: array[2..999983] of boolean;
primes: intar;
begin
for i := 2 to 999983 do
p[i] := true;
for i := 2 to 997 do
for j := 2 to 999983 div i do
p[i * j] := false;
j := 0;
setlength(primes, 78498);
for i := 2 to 999983 do
if p[i] then
begin
primes[j] := i;
inc(j)
end;
repeat
readln(a, b);
a := a * b div sqr(gcd(a, b));
b := 0;
for i := 0 to bisect_left(primes, trunc(sqrt(a))) do
while a mod primes[i] = 0 do
begin
a := a div primes[i];
b := b + 1
end;
if a = 1 then
writeln(b)
else
writeln(b + 1)
until eof(input)
end.
|