原题链接http://projecteuler.net/problem=40

An irrational decimal fraction is created by concatenating the positive integers:

0.123456789101112131415161718192021…

It can be seen that the 12th digit of the fractional part is 1.

If d(n)represents the nth digit of the fractional part, find the value of the following expression.

d(1) d(10) d(100) d(1000) d(10000) d(100000) d(1000000)

Champernowne数
将正整数连接起来可以得到一个无规则的十进制小数
0.123456789101112131415161718192021…
可以看到小数点后的第12位是1
如果记d(n) 代表小数点后的第 n位,求下面表达式的值
d(1) d(10) d(100) d(1000) d(10000) d(100000) d(1000000)

解答:
不知道数学解法,只好暴力了。

原题链接 http://projecteuler.net/problem=39

Integer right triangles

If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.

{20,48,52}, {24,45,51}, {30,40,50}

For which value of p <= 1000, is the number of solutions maximised?

直角三角形的个数

如果p是直角三角形的周长,它的三个边为{a,b,c},对于p = 120,正好有三个直角三角形

{20,48,52},{24,45,51},{30,40,50}

对于p <= 1000,求存在三角形个数最多的数

解答:

这题没什么好说的。

原题链接 http://projecteuler.net/problem=38

Pandigital multiples

Take the number 192 and multiply it by each of 1, 2, and 3:

192 * 1 = 192

192 * 2 = 384

192 * 3 = 576

By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1,2,3)

The same can be achieved by starting with 9 and multiplying by 1, 2, 3, 4, and 5, giving the pandigital, 918273645, which is the concatenated product of 9 and (1,2,3,4,5).

What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, … , n) where n >1?

全位数乘数

取数字192,将它乘以分别乘以1,2和3:

192 * 1 = 192

192 * 2 = 384

192 * 3 = 576

将这些乘积连接起来,我们将得到一个从1到9的全位数,192384576.我们称192384576为192和(1,2,3)的乘积连接

类似的,我们可以从9开始,将它乘以1,2,3,4和5,得到一个全位数,918273645,即为9和(1,2,3,4,5)的乘积连接。

求由一个整数和(1,2,…,n, n > 1)的乘积连接中得到的1到9的全位数中,最大的那个。

解法:

这题没什么好说的。

原题链接 http://projecteuler.net/problem=37

Truncatable primes

The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.

Find the sum of the only eleven primes that are both truncatable from left to right and right to left.

NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.

可截断的素数

数3797有一个有趣的特性。它本身是素数,而且从左到右删除数字依然是素数:3797,797,97和7.类似的,从右到左也是这样:3797,379,37,和3.

求唯一的11个从左到右,从右到左都可截断的素数的和

注意:2,3,5,和7不认为是可截断的素数

解答:

这题没什么好说的。依然是筛法生成素数表,只是不知道素数到底会大到什么程度,所以写的有些丑陋。

原题链接 http://projecteuler.net/problem=36

Double-base palindromes

The decimal number, 585 = 1001001001 (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 not include leading zeros.)

双进制回文数

对于10进制数,585 = 1001001001(二进制),在两种进制下都是回文数。

求小于1 000 000的数,求所有满足10进制和二进制都是回文数的数的和

(注意,对于所有的回文数,在任何进制中,都不包括开头中的0)

解答:

这题没什么好说的,无非就是进制的转换以及判断回文数。

原题链接 http://projecteuler.net/problem=35
Circular primes
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.

There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.

How many circular primes are there below one million?

循环素数

对于数字,197,我们称它为循环素数,这是因为旋转数的数字得到的所有数:197,971和719都是素数

100一下一共有13个这种素数:2,3,5,7,11,13,17,31,37,71,73,79和97.

求1000000一下,一共有多少个循环素数?

解答:
关键还是生成一个素数判断表,用筛法。其它没什么好说的。

原题链接 http://projecteuler.net/problem=34

Digit factorials

145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.

Find the sum of all numbers which are equal to the sum of the factorial of their digits.

Note: as 1! = 1 and 2! = 2 are not sums they are not included.

数字的阶乘

145是一个特殊的数字,因为1! + 4! + 5! = 1 + 24 + 120 = 145.

求所有满足数的每位数的阶乘之和等于数本身这个条件的数的和
注意:因为1!= 1 和 2!= 2不是和,所以没有被包括进来。

原题链接 http://projecteuler.net/problem=33

Digit canceling fractions

The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that49/98 = 4/8, which is correct, is obtained by cancelling the 9s.

We shall consider fractions like, 30/50 = 3/5, to be trivial examples.

There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.

If the product of these four fractions is given in its lowest common terms, find the value of the denominator.

数字约分

分数49/98是一个特殊的分数,对于一个不熟练的数学爱好者在尝试化简它时,可能会错误地消去9,认为49/98 = 4 / 8,最终的到的结果是正确的。

对于分数30/50 = 3/5,我们认为这是平凡的例子

正好存在4个这种不平凡的分数,它们的值小于1,分子和分母都是两位数。

如果将这四个分数的乘积化简为最简形式,得到的分母是什么?

解答:

这题没什么好说的。

原题链接 http://projecteuler.net/problem=32

Pandigital products

We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.

The product 7254 is unusual, as the identity, 39 * 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.

Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.

全位数乘积
如果一个n位数恰好使用1到n各一次,我们称这个数为全位数;例如,5位数,15234,是一个1到5的全位数。

乘积7254不寻常,对于恒等式 39 * 186 = 7254,包括被乘数,乘数,乘积,正好是一个1到9的全位数

求所有满足被乘数,乘数,乘积这个恒等式是从1到9的全位数这个条件的乘积的和。
提示:有些乘积可以有不只一种形式,要确保只计算一次。
解法:
这题没什么好说的。

原题链接 http://projecteuler.net/problem=31

Coin sums

In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:

1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).

It is possible to make £2 in the following way:

1£1 + 150p + 220p + 15p + 12p + 31p

How many different ways can £2 be made using any number of coins?

硬币的和

在英国,货币单位有磅(£),便士(p),一共有八种硬币发行:

1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).

对于£2可以有以下组成形式:

1£1 + 150p + 220p + 15p + 12p + 31p

求£2的组成方式一共有多少种?

解法:

这是一个多重背包问题。两个循环解决问题,注意循环的顺序。