(package test)
(using
little.lang.Array
little.lang.System
little.io.TextOutputStream)
(class Sieve ()
(method main () :static
(let ((num (((System:arguments):nextElement):toint))
(flags (Array:new 8193))
(count 0))
(while (num:gt 0)
(set num (num:pred))
(set count 0)
(let ((i 2))
(while (i:le 8192)
(flags:put i true)
(set i (i:succ))))
(let ((i 2))
(if (flags:get i)
(let ((k (i:add i)))
(while (k:le 8192)
(flags:put k nil)
(set k (k:add i)))
(set count (count:succ)))
nil)))
((TextOutputStream:put):println "Count:" count)))
)