QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#14864. 雅可比数

Estadísticas

卡尔·古斯塔夫·雅各布·雅可比(Carl Gustav Jacob Jacobi,1804–1851),瓦恩弗里德·伊马吉努斯(Wahnfried Imaginus)的著名兄弟。维基共享资源上的公有领域图片。

今天,在《虚构计算先驱公报》(Bulletin of Apocryphal Pioneers in Computation)上发表了一篇新论文。根据这篇论文,被遗忘的德国数论学家瓦恩弗里德·伊马吉努斯·雅可比(Wahnfried Imaginus Jacobi,1806–1853)在波茨坦读中学时,就研究了将整数分解为立方和的问题。

在他笔记本残卷中记录的例子包括:

$$2025 = 1^3 + 2^3 + 3^3 + 4^3 + 5^3 + 6^3 + 7^3 + 8^3 + 9^3$$

以及更奇妙的表达式:

$$3 = 1^3 + 1^3 + 1^3 = 4^3 + 4^3 + (-5)^3$$

这表明解不一定是唯一的。雅可比将注意力限制在较小的整数上,可能并不知道以下分解:

$$3 = 569\,936\,821\,221\,962\,380\,720^3 + (-569\,936\,821\,113\,563\,493\,509)^3 + (-472\,715\,493\,453\,327\,032)^3$$

该分解直到最近才被发现[^1]。然而,雅可比确实成功证明了,对于不超过 $9241$(第一类第 28 个古巴素数)的所有正整数,总是存在立方和分解。尽管他的工作从未发表,但在 1823 年写给其著名兄弟卡尔·古斯塔夫·雅各布的一封信的边注中,提到了这种方法。

给定一个正整数 $n$,输出一个最多包含 $10\,000$ 个介于 $-10\,000$ 和 $10\,000$ 之间的整数的列表,使得它们的立方和等于 $n$。

[^1]: Booker, Andrew R.; Sutherland, Andrew V. (2021), “On a question of Mordell”, Proceedings of the National Academy of Sciences, 118 (11)

输入格式

输入包含:

  • 一行,包含一个整数 $n$ ($1 \le n \le 9241$),即要分解为立方和的数。

输出格式

输出一个整数 $k$ ($1 \le k \le 10\,000$),表示你求得的解中的项数,随后是 $k$ 个整数 $a_1, \dots, a_k$(对每个 $i$ 均满足 $-10\,000 \le a_i \le 10\,000$),使得 $a_1^3 + \dots + a_k^3 = n$。

如果存在多个可行解,你可以输出其中任意一个。

样例

输入样例 1

2025

输出样例 1

9
1 2 3 4 5 6 7 8 9

输入样例 2

45

输出样例 2

3
2025 -2369 1709

输入样例 3

15

输出样例 3

3
-1 2 2

输入样例 4

9241

输出样例 4

2
-55 56

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.