文章目錄

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

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

打赏作者

文章目錄