Semiprime: Difference between revisions

Semiprime in various BASIC dialents
(Added solution for Action!)
(Semiprime in various BASIC dialents)
Line 359:
1675-1680: 1678 1679
</pre>
 
 
=={{header|BASIC}}==
==={{header|BASIC256}}===
<lang BASIC256>function semiprime$ (n)
a = 2
c = 0
while c < 3 and n > 1
if (n mod a) = 0 then
n = n / a
c = c + 1
else
a = a + 1
end if
end while
if c = 2 then return "True"
return "False"
end function
 
for i = 0 to 64
print i, semiprime$(i)
next i
end</lang>
 
==={{header|PureBasic}}===
<lang PureBasic>Procedure.s semiprime(n.i)
a.i = 2
c.i = 0
While c < 3 And n > 1
If (n % a) = 0
n / a
c + 1
Else
a + 1
EndIf
Wend
If c = 2
ProcedureReturn "True" ;#True
EndIf
ProcedureReturn "False" ;#False
EndProcedure
OpenConsole()
For i.i = 0 To 64
PrintN(Str(i) + #TAB$ + semiprime(i))
Next i
 
PrintN(#CRLF$ + "--- terminado, pulsa RETURN---"): Input()
CloseConsole()
End</lang>
 
==={{header|Yabasic}}===
<lang yabasic>sub semiprime$ (n)
a = 2
c = 0
while c < 3 and n > 1
if mod(n, a) = 0 then
n = n / a
c = c + 1
else
a = a + 1
end if
wend
if c = 2 then return "True" : fi
return "False"
end sub
 
for i = 0 to 64
print i, chr$(9), semiprime$(i)
next i
end</lang>
 
 
=={{header|Bracmat}}==
2,130

edits