You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
531 B

REBOL [
Title: "Rebol Prime Number Finder"
Date: 02-Dec-2003
Author: haplo@mindstab.net
Version: 1.0
File: %primes.r
Home: http://www.mindstab.net/primes
]
; Command line argument getting code borrowed from
; http://www.melbpc.org.au/pcupdate/2305/2305article6.htm
cl_args: make block! system/script/args
max: either none? cl_args/1 [""] [to-integer cl_args/1]
for cnt 3 max +2 [
sq: to-integer(square-root(cnt))
isp: 1
for i 3 sq +2 [
isp: cnt // i
if isp = 0 [
break
]
]
if isp <> 0 [ print cnt ]
]