問題一覧 > 通常問題

No.3332 Consecutive Power Sum (Small)

レベル : / 実行時間制限 : 1ケース 2.025秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 42
作問者 : wasd314 / テスター : にょぐた Vi24E
お気に入りにしたユーザー ProblemId : 12100 / 自分の提出
問題文最終更新日: 2025-10-31 08:10:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
wasd314 さんの単発問題コンテスト (順位表) の他の問題:

Reference

Consecutive Cubic Sum, Consecutive Power Sum (Small), Consecutive Power Sum (Large) are, in this order, roughly each a generalization of the previous one.

Problem Statement

For three positive integers $E, L, R$, define $S(E, L, R)$ by $$ S(E, L, R) \coloneqq \sum_{i = L}^R i^E $$ .

You are given a positive integer $N$. Find all triples of positive integers $(E, L, R)$ that satisfy both of the following two conditions.

  • $1 \le L \le R$
  • $S(E, L, R) = N$

Constraints

The input $N$ is an integer between $2$ and $10^{12}$, inclusive.

Input

The input is given from standard input in the following format.

$N$

Output

We call a triple satisfying the conditions in the problem statement a solution. It can be proved that there are finitely many solutions under the constraints of this problem. If there are $C$ solutions in total and they are, in ascending lexicographic order, $$ (E_1, L_1, R_1), (E_2, L_2, R_2), \dots, (E_C, L_C, R_C) $$ then output $C + 1$ lines in the following format. Separate the values on each line with spaces, and also output a newline at the end.

$C$
$E_1\ L_1\ R_1$
$E_2\ L_2\ R_2$
$\vdots$
$E_C\ L_C\ R_C$

Sample

Sample 1
Input
2
Output
1
1 2 2

The following equation holds. Note that $L = R$ is allowed.

  • $S(1, 2, 2) = 2^1 = 2$

$(1, 2, 2)$ is the only solution.

Sample 2
Input
24979
Output
4
1 12489 12490
1 24979 24979
2 62 67
4 5 10

There may be multiple solutions.

The following equations hold.

  • $S(1, 12\,489, 12\,490) = 12\,489^1 + 12\,490^1 = 24\,979$
  • $S(1, 24\,979, 24\,979) = 24\,979^1 = 24\,979$
  • $S(2, 62, 67) = 62^2 + 63^2 + 64^2 + 65^2 + 66^2 + 67^2 = 24\,979$
  • $S(4, 5, 10) = 5^4 + 6^4 + 7^4 + 8^4 + 9^4 + 10^4 = 24\,979$

Output the solutions in ascending lexicographic order.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。