2009-02-01から1ヶ月間の記事一覧

Project Euler: Problem 36

The decimal number, 585 = 1001001001_(2) (binary), is palindromic in both bases.Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.(Please note that the palindromic number, in either base, may n…

Project Euler: Problem 25

The Fibonacci sequence is defined by the recurrence relation: F(n) = F(n−1) + F(n−2), where F(1) = 1 and F(2) = 1.Hence the first 12 terms will be: F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3 F(5) = 5 F(6) = 8 F(7) = 13 F(8) = 21 F(9) = 34 F(10) =…

Project Euler: Problem 20

数を稼ぐために、ひとまず簡単そうなのから先に潰していく方針に変更。Problem 20。 n! means n * (n - 1) * ... * 3 * 2 * 1Find the sum of the digits in the number 100! http://projecteuler.net/index.php?section=problems&id=20 100! の計算結果に含…

エンドオブ年度

log

先のことを考えただけでこんなにも頭が重くなるのは、どうしてなんだろうな。

Project Euler: Problem 14

Problem 14 をやってなかったのでやってみた。 The following iterative sequence is defined for the set of positive integers: n -> n/2 (n is even) n -> 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following seque…

irrational rational

もう時効っぽいから晒してみよう。必殺仕事請負人で適当に作った課題作品。循環小数(=> 有理数)の計算結果の小数ストリームから循環部分を探すスクリプト。除算の結果を先頭から適当な状態機械に食わせて循環部分とそれ以外の 2 値を返す。コマンドラインか…