Primality by trial division: Difference between revisions
m
→{{header|FutureBasic}}
(Primality by trial division in Yabasic) |
|||
Line 1,975:
=={{header|FutureBasic}}==
<lang futurebasic>
local fn isPrime( n as long ) as Boolean
if n < 2 then result =
if n = 2 then result =
if n mod 2 == 0 then result =
result =
if n mod i == 0 then result = NO : break
next i
end fn = result
print "Prime numbers between 0 and 1000:"
for i = 0 to 1000
if ( fn isPrime(i) != _false )
if j mod 10 == 0 then print
end if
next
HandleEvents</lang>
Output:
Prime numbers between 0 and 1000:
127 131 137 139 149 151 157 163 167 173
179 181 191 193 197 199 211 223 227 229
|