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

Sub-string divisibility

The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property.

Let d(1)be the 1st digit, d(2) be the 2nd digit, and so on. In this way, we note the following:

d(2)d(3)d(4)=406 is divisible by 2

d(3)d(4)d(5)=063 is divisible by 3

d(4)d(5)d(6)=635 is divisible by 5

d(5)d(6)d(7)=357 is divisible by 7

d(6)d(7)d(8)=572 is divisible by 11

d(7)d(8)d(9)=728 is divisible by 13

d(8)d(9)d(10)=289 is divisible by 17

Find the sum of all 0 to 9 pandigital numbers with this property.
子串可除性
数1406357289是一个0到9的全位数,因为它由0到9组成,每个数字出现一次,它有一个有趣的字串可除性特性
令d(1)为第一个数字,d(2) 为第二个数字,以此类推。这种方式,我们注意如下:
d(2)d(3)d(4)=406可以被2整除
d(3)d(4)d(5)=063可以被3整除
d(4)d(5)d(6)=635可以被5整除
d(5)d(6)d(7)=357可以被7整除
d(6)d(7)d(8)=572可以被11整除
d(7)d(8)d(9)=728可以被13整除
d(8)d(9)d(10)=289可以被17整除
求所有具有这种性质的0到9的全位数的和

解答:
注意观察,观察,再观察,完全可以动手算出这题。而我不会写搜索的,只好写了一个非常丑陋的多重循环。

联系作者

原题链接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不是和,所以没有被包括进来。

联系作者