11 lines
291 B
Text
11 lines
291 B
Text
|
|
SemiPrimes := proc( n )
|
||
|
|
local fact;
|
||
|
|
fact := NumberTheory:-Divisors( n ) minus {1, n};
|
||
|
|
if numelems( fact ) in {1,2} and not( member( 'false', isprime ~ ( fact ) ) ) then
|
||
|
|
return n;
|
||
|
|
else
|
||
|
|
return NULL;
|
||
|
|
end if;
|
||
|
|
end proc:
|
||
|
|
{ seq( SemiPrimes( i ), i = 1..100 ) };
|