gracias 发表于 2011-10-31 23:22:24

project euler 152

There are several ways to write the number 1/2 as a sum of inverse squares using distinct integers.

For instance, the numbers {2,3,4,5,7,12,15,20,28,35} can be used:

In fact, only using integers between 2 and 45 inclusive, there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45} and {2,3,4,6,7,9,12,15,28,30,35,36,45}.

How many ways are there to write the number 1/2 as a sum of inverse squares using distinct integers between 2 and 80 inclusive?
各位谁有兴趣算算这道题看是多少? 我怎么算都是273,但结果不正确 !

〇〇 发表于 2011-11-4 21:03:39

把273种罗列出来?

〇〇 发表于 2011-11-5 11:08:14

感觉如果1/7 1/9用了那么1/281/35 ,1/36 1/45也要用...

gracias 发表于 2011-11-5 12:21:30

感觉如果1/7 1/9用了那么1/281/35 ,1/36 1/45也要用...
〇〇 发表于 2011-11-5 11:08 http://bbs.emath.ac.cn/images/common/back.gif

http://www.ben1222.com/wordpress/archives/category/project-euler
我参考了这个页面里的提示,预先排除了分母含大于等于7因子的候选(含因子13的所有可能组合另用一个1/12^2 替代)。
将以下组合的结果替换含因子7的那些可能的组合去穷举的。但结果不对
"1/7^2+ 1/14^2 + 1/21^2",
"1/7^2+ 1/14^2 + 1/21^2 + 1/28^2 + 1/35^2 + 1/42^2 + 1/56^2 + 1/63^2 + 1/70^2" ,
"1/7^2+ 1/14^2 + 1/21^2 + 1/35^2 + 1/42^2 + 1/77^2",
"1/7^2+ 1/14^2 + 1/28^2 + 1/35^2 + 1/56^2 + 1/70^2",
"1/7^2+ 1/14^2 + 1/28^2 + 1/42^2 + 1/63^2 + 1/70^2",
"1/7^2+ 1/21^2 + 1/28^2 + 1/35^2 + 1/42^2 + 1/63^2",
"1/7^2+ 1/21^2 + 1/28^2 + 1/42^2 + 1/70^2" ,
"1/7^2+ 1/21^2 + 1/35^2 + 1/56^2 + 1/63^2 + 1/70^2",
"1/7^2+ 1/28^2 + 1/35^2",
"1/7^2+ 1/28^2 + 1/42^2 + 1/56^2",
"1/7^2+ 1/35^2 + 1/42^2 + 1/63^2 + 1/70^2 + 1/77^2",
"1/7^2+ 1/63^2 + 1/70^2",
"1/14^2+ 1/21^2 + 1/28^2 + 1/35^2 + 1/42^2 + 1/56^2",
"1/14^2+ 1/21^2 + 1/42^2 + 1/56^2 + 1/63^2 + 1/70^2" ,
"1/14^2+ 1/28^2 + 1/42^2" ,
"1/14^2+ 1/35^2 + 1/42^2 + 1/56^2 + 1/70^2 + 1/77^2",
"1/14^2+ 1/35^2 + 1/56^2 + 1/63^2" ,
"1/14^2+ 1/56^2 + 1/70^2",
"1/21^2+ 1/42^2 + 1/63^2",
"1/28^2+ 1/35^2 + 1/42^2 + 1/56^2 + 1/63^2 + 1/70^2",
"1/35^2+ 1/42^2 + 1/77^2",
页: [1]
查看完整版本: project euler 152