September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
18
Task/Semiprime/Phix/semiprime.phix
Normal file
18
Task/Semiprime/Phix/semiprime.phix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function semiprime(integer n)
|
||||
sequence f = prime_factors(n)
|
||||
integer l = length(f)
|
||||
return (l=2 and n=f[1]*f[2]) or (l=1 and n=power(f[1],2))
|
||||
end function
|
||||
|
||||
procedure test(integer start, integer stop)
|
||||
sequence s = {}
|
||||
for i=start to stop do
|
||||
if semiprime(i) then
|
||||
s &= i
|
||||
end if
|
||||
end for
|
||||
?s
|
||||
?length(s)
|
||||
end procedure
|
||||
test(1,100)
|
||||
test(1675,1680)
|
||||
Loading…
Add table
Add a link
Reference in a new issue