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

Prime permutations

The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.

What 12-digit number do you form by concatenating the three terms in this sequence?

素数排列
算术序列1487,4817,8147是按照3330递增的,它有两个平常的性质:(1)这三个数都是素数 (2)这三个4位数中的每一个都是另一个的排列

不存在1位,2位,3位具有这种性质的序列,但是还有另一个4位的具有这种性质的递增序列。

求将这个序列中的三个数链接起来得到的12位数

解答:
没什么好说的,先生成一个素数判别表,之后就简单了。

联系作者

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

Self powers

The series, 11 + 22 + 33 + … + 1010 = 10405071317.

Find the last ten digits of the series, 11 + 22 + 33 + … + 10001000.
​自幂

序列 11 + 22 + 33 + … + 1010 = 10405071317
求序列11 + 22 + 33 + … + 10001000​的最后十个数字​

解答:
无非是大数运算。在Python里很简单。暴力之,只是不知道有什么数学规律没,我想不到。

联系作者

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

Distinct primes factors

The first two consecutive numbers to have two distinct prime factors are:

14 = 2 7
15 = 3
5

The first three consecutive numbers to have three distinct prime factors are:
644 = 2² 7 23
645 = 3 5 43
646 = 2 17 19.
Find the first four consecutive integers to have four distinct prime factors. What is the first of these numbers?

不同的素数因子
第一个连续两个数具有两个不同的素数因子的是:
14 = 2 7
15 = 3
5

第一个连续三个数具有三个不同的素数因子的是:
644 = 2² 7 23
645 = 3 5 43
646 = 2 17 19.

请找到第一个连续四个数具有四个不同的素数因子。这些数中的第一个是什么?

解答:
无非就是求素数因子,使用第3题中的方法,得到素数因子,剩下的就是暴力了。

联系作者

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

Goldbach’s other conjecture

It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.

9 = 7 + 212
15 = 7 + 2
22
21 = 3 + 232
25 = 7 + 2
32
27 = 19 + 222
33 = 31 + 2
12

It turns out that the conjecture was false.

What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?

哥德巴赫的另一个猜想
这个猜想是克里斯蒂安.哥德巴赫提出的,它是这样的:任意一个合数,如果是奇数的话,则可以写成一个素数与一个平方数的两倍的和
9 = 7 + 212
15 = 7 + 2
22
21 = 3 + 232
25 = 7 + 2
32
27 = 19 + 222
33 = 31 + 2
12
结果这个猜想是错的。
求最小的不能写成一个素数与一个平方数的两倍的和的奇合数​

解答:
还是暴力吧。

联系作者

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

Triangular, pentagonal, and hexagonal

Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:

Triangle

T(n)=n(n+1)/2

1, 3, 6, 10, 15, …

Pentagonal

P(n)=n(3_n-_1)/2

1, 5, 12, 22, 35, …

Hexagonal

H(n)=n(2_n-_1)

1, 6, 15, 28, 45, …



It can be verified that T(285) = P(165) = H(143) = 40755.

Find the next triangle number that is also pentagonal and hexagonal.

三角形的,五边形的和六边形的
三角形的、五边形的和六边形的数可以由以下公式生成:
三角形的 T(n)=n(n+1)/2 1,3,6,10,15,…
五边形的 P(n)=n(3n-1)/2 1,5,12,22,35,…
六边形的 H(n)=n(2n-1) 1,6,15,28,45,…
可以验证T(285)=P(165)=H(143)=40755.
求下一个既是五边形数,又是六边形数的三角形数。

解法:
没想到什么好的方法,只好暴力了。

联系作者

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

Pentagon numbers

Pentagonal numbers are generated by the formula, P(n)=n(3n − 1)/2. The first ten pentagonal numbers are:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, …

It can be seen that P(4) + P(7) = 22 + 70 = 92 = P(8). However, their difference, 70 − 22 = 48, is not pentagonal.

Find the pair of pentagonal numbers, P(j)and P(k), for which their sum and difference are pentagonal and D = |P(k) − P(j)| is minimised; what is the value of D?

五边形数
五边形数可以由公式P(n) = n(3n-1)/2得到。前十个五边形数是

1,5,12,22,35,51,70,92,117,145,。。。
可以看到P(4) + P(7) = 22 + 70 = 92 = P(8).然而它们之间的差,70 - 22 = 48不是五边形数
找到五边形数对,P(j)和P(k),使得它们的和与差都是五边形数,并且D=|P(k) - P(j)|最小,那么D的值是多少?

解答:
用蛮力解决了,正在思考数学方法。

联系作者

原题链接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)

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

联系作者