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

Coded triangle numbers

The nth term of the sequence of triangle numbers is given by, t(n)= ½n(n+1); so the first ten triangle numbers are:

1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …

By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word value for SKY is 19 + 11 + 25 = 55 = t10. If the word value is a triangle number then we shall call the word a triangle word.

Using words.txt (right click and ‘Save Link/Target As…’), a 16K text file containing nearly two-thousand common English words, how many are triangle words?

三角数编码

第n个三角数可以由t(n) = n * (n + 1) / 2给出,所以前面十个三角数是
1,3,6,10,15,21,28,36,45,55,…
将单词中的每个字母与一个数字相对应,这个数字是字母在字母表中的顺序相对应,将这些数字相加就的到字母的值。例如,单词SKY的值是19 + 11 + 25 = 55 = t(10) 如果单词的值是三角数,那么我们就称这个单词为三角单词。
使用words.txt (鼠标右击,然后‘保存链接/目标另存为…’)​,在这个16K的文本文件中包含将近2000个常用的英文单词。

求一共有多少个三角单词。

解答:
这题没有什么好说的,唯一要注意的一点是要去除单词两边的双引号。

联系作者

原题链接http://projecteuler.net/problem=41
Pandigital prime
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, 2143 is a 4-digit pandigital and is also prime.
What is the largest n-digit pandigital prime that exists?

全位素数
我们称一个数是n位的全位数当这个数包含1到n正好一次,例如2143是一个四位的全位数,同时它也是一个素数。
求最大的n位全位素数

解法:
还是暴力,从最大的9位素数开始往更小的素数找。方法太笨了,所以速度很慢。的确是太慢了,所以一定有更好的解决方法。经过观察,是不存在8位和9位的全位数是素数的情况,至于为什么,自己观察。

联系作者

原题链接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,分子和分母都是两位数。

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

解答:

这题没什么好说的。

联系作者