Project Euler [Problem 44]

間が開いた

問題

Pentagon numbers

Pentagonal numbers are generated by the formula,  P_n = \frac{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 = \frac{n(3n - 1)}{2} で与えられる。 最初の 10 個は:

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 の値はいくつか?

解答方針

力任せに探索したら見つかってしまった……。