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

#

Combinatoric selections

There are exactly ten ways of selecting three from five, 12345:

123, 124, 125, 134, 135, 145, 234, 235, 245, and 345

In combinatorics, we use the notation, C(5,3) = 10.

In general,

C(n,r)=n!/(r!(n-r)!), where r <= n, n! = n (n - 1) 3 2 * 1,and 0! = 1.

It is not until n = 23, that a value exceeds one-million: C(23,10) = 1144066.

How many, not necessarily distinct, values of C(n,r), for 1 <= n <= 100, are greater than one-million?

组合选择

从五个,12345中选出三个一共有10中方法

123, 124, 125, 134, 135, 145, 234, 235, 245, and 345

在组合中我们使用记号C(5,3) = 10.

一般来说

C(n,r)=n!/(r!(n-r)!),r <= n, n! = n (n - 1) 3 2 * 1, 且0! = 1

直到n = 23,才出现值超过1000000: C(23,10) = 1144066.

求一共有多少个值,没有必要是唯一的,使得C(n,r), 1 <=n<= 100,超过1000000?

解答:

遍历吧。

联系作者

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

Permuted multiples

It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.

Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
倍数排列
可以看到数125874和它的两倍251748,包含相同的数字,只是顺序不同。
找出最小的正整数x,使得x,2x,3x,4x,5x,和6x包含相同的数字。

解答:
暴力吧,有一点要注意的是,第一个数字一定是1。

联系作者

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

Prime digit replacements

By replacing the 1st digit of the 2-digit number *3, it turns out that six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all prime.

By replacing the 3rd and 4th digits of 56**3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding the family: 56003, 56113, 56333, 56443, 56663, 56773, and 56993. Consequently 56003, being the first member of this family, is the smallest prime with this property.

Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime value family.

素数数字替换

通过替换两位数*3的第一位数字,我们得到9个数字中的6个是素数:13,23,43,53,73和83.

通过用同一数字替换数56**3的第3、4位,这个5位数是第一个数,使得替换之后的10个数中,有7个数是素数。这就形成一个家族,它们是:56003,56113,56333,56443,56773和56993。56003则是这个素数族的第一个成员,是具有这种性质的最小素数。

找出最小的素数,通过用相同的数字替换这个素数中的一部分数字(没有必要想邻),可以得到一个素数,这个素数是8素数族的一部分。

解答:

一时还想不出好的办法,先空着。

联系作者

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

Consecutive prime sum

The prime 41, can be written as the sum of six consecutive primes:
41 = 2 + 3 + 5 + 7 + 11 + 13
This is the longest sum of consecutive primes that adds to a prime below one-hundred.

The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.

Which prime, below one-million, can be written as the sum of the most consecutive primes?

连续素数的和
素数41,可以写成6个连续素数的和:
41 = 2 + 3 + 5 + 7 + 11 + 13
这是100以下最长的连续素数的和等于一个素数
1000以下最长的连续素数的和,包含21个数,等于953
求1 000 000​以下能写成最长连续素数的和的素数


解法:
不懂得数学方法,只好暴力了,先求出1000 000以下素数,之后双重循环。太暴力了,竟然用了18分钟,看来还是得想办法改进。果然还是有方法的,想办法生成一个三角形,最底层是1000 000以下素数,上一层是连续两个素数之和,再上一层是连续三个素数之和,。。最后一层就是所有素数之和,从上往下找,第一个小于1000000的素数就是答案。实际过程中,可以不用从最顶上开始找,可以从第一个大于1000000那一行开始往下找,然后由这一行的数生成下一行,继续找。

联系作者

原题链接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的值是多少?

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

联系作者