100 までの素数(キミならどう書く 2.0 - ROUND 1 -)
http://ll.jus.or.jp/2006/blog/categories/doukaku2.0
もう遅いか。うち着いたの45分ぐらいだもんな。。。
ルートnが必要だと思って、mathn.rb のヘルプ見たら、素数もあるじゃん。
あるものは使えばいいのさ。ってことで、ほとんどヘルプそのまま。
require 'mathn'
pp = Prime.new;
pp.each {|x|
break if x > 100;
puts x;
}
いかに再利用できるかだよね。ソフトは。
意図が違うのはわかるけどさ。
| 固定リンク
「プログラミング」カテゴリの記事
- ListView の Height は WRAP_CONTENT を避けるべき(2015.12.23)
- プログラミングコンテストチャレンジブック(2010.09.27)
- 久しぶりに(2009.03.18)
- AVR-USB, hid-data(2008.11.24)
- AVR-USB、Tiny45 の internal RC oscillator で動作!(2008.11.08)
この記事へのコメントは終了しました。
コメント
ここであえて、Peter Shorのアルゴリズムを使ってほしいです(汗)
投稿: はろ | 2006.06.28 01:26
Peter Shor って?
と思ってぐぐってみたら、量子コンピュータですか?
先月の Newton は量子論でしたが、量子コンピュータと関係あったりします?
realloc() の使い方間違ってるくせに修正する気が全く無い Peter なら知ってますけど。^^;
投稿: Salt | 2006.06.29 00:25
like other posts here, take a look at this website, just like the world cup , best payout games and best payout casinos, read it and thought you need a breakaway, just like playing the world cup , money games and best payout games, today is your lucky day? , world cup winner
投稿: | 2006.07.17 08:18
we welcome anyone, above 18 years old, games lover , money games and payout games, just visited here, enjoy watching the world cup matches , best payout casinos and payout games, just visited here, enjoy watching the world cup matches
投稿: | 2006.07.25 03:11