scheme

Project Euler: Problem 19

You are given the following information, but you may prefer to do some research for yourself. * 1 Jan 1900 was a Monday. * Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has …

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! の計算結果に含…

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 値を返す。コマンドラインか…

Project Euler: Problem 18

By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 5 2 4 6 8 5 9 3That is, 3 + 7 + 4 + 9 = 23.Find the maximum total from top to bottom of the trian…

Project Euler: Problem 17

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 used in total.If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters…

Project Euler: Problem 16

すぐ解ける問題から飛ばし飛ばしに解いてしまうのはあまり良くないかな…。 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)? http://projecteuler.net/index.php?section=proble…

Project Euler: Problem 13

Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629…

Project Euler: Problem 12 #1

The sequence of triangle numbers is generated by adding the natural numbers. So the 7^(th) 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, 55, ...Let us list the factor…

Project Euler: Problem 11

In the 20x20 grid below, four numbers along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67…

Project Euler: Problem 10

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. http://projecteuler.net/index.php?section=problems&id=10 2,000,000 以下の自然数列の中に現われる素数の合計を求めよとのこと。とりあえず、P…

Project Euler: Problem 9

A Pythagorean triplet is a set of three natural numbers, a a^(2) + b^(2) = c^(2)For example, 3^(2) + 4^(2) = 9 + 16 = 25 = 5^(2).There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. http://projecte…

Project Euler: Problem 8

Find the greatest product of five consecutive digits in the 1000-digit number.73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698…

Project Euler: Problem 7

クリスマスも年末年始も…素数を数えるんだ。 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6^(th) prime is 13.What is the 10001^(st) prime number? http://projecteuler.net/index.php?section=problems&id=7 1…

Project Euler: Problem 4

明日から冬休みらしいんだけど、いまいち実感が湧かない。気合いを入れるために Project Euler やってみたけど、いまいちきれいに書けた気がしない。 A palindromic number reads the same both ways. The largest palindrome made from the product of two …

Project Euler: Problem 6

The sum of the squares of the first ten natural numbers is, 1^(2) + 2^(2) + ... + 10^(2) = 385The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^(2) = 55^(2) = 3025Hence the difference between the sum of the squa…

Project Euler: Problem 5

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? http://projecteuler.net/index.php?section=pr…

Project Euler: Problem 3

The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ? http://projecteuler.net/index.php?section=problems&id=3 バカでかい合成数 (600851475143) を分解して得られる最大の素因数を求めよとの…

Project Euler: Problem 2

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-valued terms in the sequence whi…

Project Euler: Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000. http://projecteuler.net/index.php?section=problems&id=…