33 lines
664 B
Text
33 lines
664 B
Text
func IsPrime(N); \Return 'true' if N is prime
|
|
int N, I;
|
|
[if N <= 2 then return N = 2;
|
|
if (N&1) = 0 then \even >2\ return false;
|
|
for I:= 3 to sqrt(N) do
|
|
[if rem(N/I) = 0 then return false;
|
|
I:= I+1;
|
|
];
|
|
return true;
|
|
];
|
|
|
|
func Factors(N); \Return number of factors for N
|
|
int N, Cnt, F;
|
|
[Cnt:= 0;
|
|
F:= 2;
|
|
repeat if rem(N/F) = 0 then
|
|
[Cnt:= Cnt+1;
|
|
N:= N/F;
|
|
]
|
|
else F:= F+1;
|
|
until F > N;
|
|
return Cnt;
|
|
];
|
|
|
|
int C, N;
|
|
[C:= 0;
|
|
for N:= 4 to 120 do
|
|
if IsPrime(Factors(N)) then
|
|
[IntOut(0, N);
|
|
C:= C+1;
|
|
if rem(C/10) then ChOut(0, 9\tab\) else CrLf(0);
|
|
];
|
|
]
|