RosettaCodeData/Task/Semiprime/PL-0/semiprime.pl0
2023-07-01 13:44:08 -04:00

20 lines
357 B
Text

var n, count, factor;
begin
? n;
if n < 0 then n := -n;
count := 0;
if n >= 2 then
begin
factor := 2;
while factor <= n do
begin
while (n / factor) * factor = n do
begin
count := count + 1; n := n / factor
end;
factor := factor + 1
end;
end;
if count = 2 then ! 1;
if count <> 2 then ! 0
end.