Well, since everyone else is posting lovely numbers i'll post mine for
my solution:

luke@fish ~ $ time ruby sample.rb  5_000_000 1_000_000_000 > /dev/null

real    0m17.584s
user    0m16.144s
sys     0m0.760s
luke@fish ~ $ time ruby sample.rb  5_000_000 1_000_000_000 > big_sample.txt

real    0m17.386s
user    0m16.112s
sys     0m0.918s
luke@fish ~ $ head big_sample.txt
65
211
510
683
917
1134
1313
1533
1695
1955
luke@fish ~ $ tail big_sample.txt
999998195
999998332
999998557
999998735
999998869
999999077
999999307
999999581
999999602
999999849

Also please note that the actual algorithm itself is 5 lines, including
3 assignment statements. Running gentoo linux for amd64, with an
athlon64 3500+.
-- 
Luke Worth