問24・25:辞書式順列と1000桁のフィボナッチ数列

問24:辞書式順列の問題 Lexicographic permutations A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digit […]

続きを読む

問23:非過剰数和

今回の問題 Non-abundant sums A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of […]

続きを読む

アルファベットを1〜26の数字に変換して名前リストの総和を求めるメソッドをテスト駆動開発する(Project Euler 問22)

今回の問題 Names scores Using names.txt (right click and ‘Save Link/Target As…’), a 46K text file containing over five-thousand first nam […]

続きを読む

友愛数の総和を求めるメソッドをテスト駆動開発する(Project Euler 問21)

今回の問題 Amicable numbers Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = […]

続きを読む

各位の数字の和を求めるメソッドをテスト駆動開発する(Project Euler 問20)

今回の問題 Factorial digit sum n! means n × (n − 1) × … × 3 × 2 × 1 For example, 10! = 10 × 9 × … × 3 × 2 × 1 = 3628800, and the sum of the dig […]

続きを読む

月初が日曜日の月を数えるメソッドをテスト駆動開発する(Project Euler 問19)

今回の問題 Counting Sundays You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty d […]

続きを読む

【Project EulerにRubyで挑戦シリーズ】問18:Maximum path sum I

今回の問題 Maximum path sum I By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to b […]

続きを読む

数字を英名に変換するメソッドをテスト駆動開発で開発する(Project Euler 問17)

今回の問題 Number letter counts If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters […]

続きを読む

【Project EulerにRubyで挑戦シリーズ】問16:Power digit sum

今回の問題 Power digit sum 2**15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2**1000? 2**15 = […]

続きを読む

【Project EulerにRubyで挑戦シリーズ】問15:Lattice paths

今回の問題 Lattice paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to th […]

続きを読む