Archive for May, 2008



OMFG this is hilarious!!!

n = 1000
seive = (1..n).to_a
2.upto(Math.sqrt(n)) { |i| (i*2).step(n,i) { |x| seive[x] = nil } }
p seive.compact
see also
wow looks like this guy has me beat
(2..1000).inject((2..1000).to_a) {|res, i| res.select{|n|n==i||n%i!=0} }

Space filling surface Originally uploaded by StephanCom.
Cleaning and test




About

You are currently browsing the scattered thoughts weblog archives for May, 2008.

Longer entries are truncated. Click the headline of an entry to read it in its entirety.
    May 2008
    S M T W T F S
    « Mar   Jun »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031

    Categories: