PamGau

Web周り、サッカーの話、ときどきヌコ

2009年05月の記事一覧

RubyでProject Euler - Problem 10
Problem 10 (Project Euler) [和訳]) The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. さすがに200万までの素数となると、「mathn」のPrimeだと少し遅く感じます。もちろん、「next_prime」も同様。解答...
2009/05/31 - [Ruby]
RubyでProject Euler - Problem 9
Problem 9 (Project Euler) [和訳]) A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Fi...
2009/05/31 - [Ruby]
RubyでProject Euler - Problem 8
Problem 8 (Project Euler) [和訳]) Find the greatest product of five consecutive digits in the 1000-digit number.以下略 なんかどうやっても大差はないようで、解説のPDF文書もありません。 課題の文字列を"split(//)"で配列にしてから、"to_i"で計算しただ...
2009/05/31 - [Ruby]
RubyでProject Euler - Problem 7
Problem 7 (Project Euler) [和訳]) By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? 件のメソッド「next_prime」では答えにたどり着くのに2分近くかかりました(笑) ...
2009/05/30 - [Ruby]
RubyでProject Euler - Problem 6
Problem 6 (Project Euler) [和訳]) The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between t...
2009/05/30 - [Ruby]
RubyでProject Euler - Problem 5
Problem 5 (Project Euler) [和訳]) 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest number that is evenly divisible by all of the numbers from 1 to 20? 電卓を使って...
2009/05/30 - [Ruby]
RubyでProject Euler - Problem 4
Problem 4 (Project Euler) [和訳]) A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. Ru...
2009/05/29 - [Ruby]
RubyでProject Euler - Problem 3
Problem 3 (Project Euler) [和訳]) The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ? 素因数分解の問題ですから、素数のリストが必要となります。 Rubyに標準で添付されている「mathn」というラ...
2009/05/29 - [Ruby]
RubyでProject Euler - Problem 2
Problem 2 (Project Euler) [和訳]) Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...Find the sum of all the even-value...
2009/05/28 - [Ruby]
RubyでProject Euler - Problem 1
はじめに ご無沙汰しておりました。 私自身は健康だったのですが、いろいろときついことが重なり、Webから離れてしまった次第です。 さて、気を取り直し、表題の通りやってみます。 Project Euler 既に同様のことを実施されているブログもいくつかありますが、...
2009/05/26 - [Ruby]
Recent Entries
京都御苑の「自転車道」
Googleの左サイドバーを消すユーザスタイルシート for Firefox , Opera
"Ruby Way"章頭の言葉
"The worst feelings in life"より
裸の英会話
RubyでProject Euler - Problem 59
RubyでProject Euler - Problem 58
RubyでProject Euler - Problem 57
RubyでProject Euler - Problem 55, 56
RubyでProject Euler - Problem 54
Links
PamGau 系
PamGau::Memo
PamGau::Dust
PamgauSigh Wiki
はてなブックマーク
パンパでガウチョ
kyorecobaのdel.icio.us
BLOGNAVI
XREA.COM
VALUE-DOMAIN
PHP ver 4.4.2
Powered by Nucleus CMS Creative Commons
feedberner banner この日記のはてなブックマーク数
BlogPeople
あわせて読みたい