(ProjectEuler)总和组合组合、总和、ProjectEuler

2023-09-11 01:55:43 作者:痞

从 ProjectEuler.net :

习题76:如何许多不同的方法可以百写成的至少两个正整数的总和

我不知道如何启动这个......任何点在正确的方向,或帮助?我不是在寻找如何做到这一点,但有些提示如何做到这一点。

I have no idea how to start this...any points in the right direction or help? I'm not looking for how to do it but some hints on how to do it.

例如5可以这样写:

4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1

于是6的可能性总量。

So 6 possibilities total.

推荐答案

分区编号(或分区功能)是关键这一点。

Partition Numbers (or Partition Functions) are the key to this one.

这样的问题通常比较容易,如果你开始在底部和您的方式工作,看你能不能发现任何模式。

Problems like these are usually easier if you start at the bottom and work your way up to see if you can detect any patterns.

P(1)= 1 = {[1]} P(2)= 2 = {[2],[1 + 1]} P(3)= 3 = {[3],[2 + 1],[1 + 1 + 1]} P(4)= 5 = {[4],[3 + 1],[2 + 2],[2 + 1 + 1],[1 + 1 + 1 + 1]} P(5)= 7 ... P(6)= 11 ... P(7)= 15 ... P(8)= 22 ... P(9)= 30 ...

提示:从之前的P(N)的结果的某种组合看你能不能建立P(N)高达

Hint: See if you can build P(N) up from some combination of the results prior to P(N).