2009-01-19から1日間の記事一覧

Rubyで三角数の約数を探せ! 〜Rubyでオイラープロジェクトを解こう!Problem12

Problem 12 - Project Eulerより The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, …

Rubyで100個の数を足す 〜Rubyでオイラープロジェクトを解こう!Problem13

Problem 13 - Project Eulerより Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 以下の50桁数字100個の合計における最初の10桁を算出せよ。 配列に入れてinject(:+)します number = <