The sieve of eratosthenes
io
#!/usr/bin/env io
# Written by Darren Kirby
x := args at(1) asNumber
set := Range setRange(3, x, 2) asList
2 print
" " print
while(set at(0) <= x sqrt,
curr := set removeFirst
curr print
" " print
set foreach(i, if(i mod(curr) == 0, set remove(i)))
)
set foreach(i, i print ; " " print)
"\n" print
stats
It is
Thursday July 24, 2008 9:32 am
This page served 1281 times
This page last modified: April 14, 2008 11:28 am
Your IP address is: 38.103.63.16
You are browsing using: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
You are browsing from: United States.
badcomputer.org's uptime: 09:32:59 up 12 days, 19:59, 3 users, load average: 1.01, 1.03, 1.00
local
home | unix stuff | dir2ogg | sneetchalizer | wmainfo | q&d guide to permissions | q&d guide to tar and gzip | code | MS rant | browser shootout | linux & iAudio X5 | photos | music | programming poetry | sieve of Eratosthenes | plea | rain | suffer | archive | about | recipes | compaqr3000 | sitemap
search
credits
This page, and all pages on this site were created and are maintained by Darren Kirby using valid XHTML 1.0 and CSS, and are ©copyright 2002 - 2008. The Penguin image was created by Tukka, and is used by permission. Inspiration for the look of this site was provided by Eric A. Meyer's CSS gallery. This website runs on Gentoo Linux. It is served by Apache. PHP and MySQL hold together the backend.