Problem 261
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
-
zwuupeape
- Posts: 189
- Joined: Tue Jun 09, 2009 6:11 pm
Problem 261
Apparently someone has already managed to solve it but for some reason I get wrong answer even though I am 100 % confident about the solution.
For 10^8 I get: 242816464261
For 10^13 I get: 7482405209124158762
Perhaps my fault is with the word 'distinct' ? What is meant by distinct? For some k, there may be more than one pair of (m,n) such that (k-m)^2 + ... k^2 = (n+1)^2 + ... (n+m)^2, so there is only need to count those values of k once - right?
Thanks.
For 10^8 I get: 242816464261
For 10^13 I get: 7482405209124158762
Perhaps my fault is with the word 'distinct' ? What is meant by distinct? For some k, there may be more than one pair of (m,n) such that (k-m)^2 + ... k^2 = (n+1)^2 + ... (n+m)^2, so there is only need to count those values of k once - right?
Thanks.
- stijn263
- Posts: 1505
- Joined: Sat Sep 15, 2007 11:57 pm
- Location: Netherlands
Re: Problem 261
Exactly. Your result for 108 is slightly off. I didn't check the other one. Good luck!For some k, there may be more than one pair of (m,n) such that (k-m)^2 + ... k^2 = (n+1)^2 + ... (n+m)^2, so there is only need to count those values of k once - right?
Problem 261 (View Problem)
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 261
'distinct' == 'different', so you've interpreted that correctly.
However, your values are wrong. For 108, it's 243xxxxxxxxx, for 1013: 74828xxxxxxxxxxxxxx.
However, your values are wrong. For 108, it's 243xxxxxxxxx, for 1013: 74828xxxxxxxxxxxxxx.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
Robert_Gerbicz
- Posts: 26
- Joined: Sat Oct 13, 2007 2:44 pm
Re: Problem 261
That is very interesting. My code gives the same number for n=10^8 (still no answer for n=10^10, my code is a little slow, it would take about 2 days for one core):
is it also bad:
// f(999)=8347
// f(9999)=276416
// f(99999)=8340384
// f(999999)=253131726
is it also bad:
// f(999)=8347
// f(9999)=276416
// f(99999)=8340384
// f(999999)=253131726
-
Robert_Gerbicz
- Posts: 26
- Joined: Sat Oct 13, 2007 2:44 pm
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 261
Yup.Robert_Gerbicz wrote:I found a bug, my new guess: f(10^6)=255978835
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
zwuupeape
- Posts: 189
- Joined: Tue Jun 09, 2009 6:11 pm
Re: Problem 261
I now tried a completely different approach. Scales much, much worse than the other but apparently finds some that the other misses - I cannot, for the life of mine, understand why. And it still doesn't match f(10^6) ...
Who can confirm 8446625 for 10^5?
277236 for 10^4 ?
Who can confirm 8446625 for 10^5?
277236 for 10^4 ?
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 261
Not I. You're still missing some.zwuupeape wrote:I now tried a completely different approach. Scales much, much worse than the other but apparently finds some that the other misses - I cannot, for the life of mine, understand why. And it still doesn't match f(10^6) ...
Who can confirm 8446625 for 10^5?
That, yes.277236 for 10^4 ?
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
Rodinio
- Posts: 5
- Joined: Sat Oct 24, 2009 10:08 pm
Re: Problem 261
OK,
first post...
I really like this problem, and am sure to finish it quickly if it were not for the special special cases that I keep finding.
Can anyone confirm 10^8 as 243xxx202099 ? First three digits are ok thanks to a previous post, I get 10^6 just fine, and the runtime for this case is well under a minute in python, so I do believe I must be on to something. But I still get the red cross, so there must be another (probably stupid) bug...
(I'm perhaps obfuscating too much here, don't want to get on the wrong side of the etiquette here...)
Cheers
Rodinio
first post...
I really like this problem, and am sure to finish it quickly if it were not for the special special cases that I keep finding.
Can anyone confirm 10^8 as 243xxx202099 ? First three digits are ok thanks to a previous post, I get 10^6 just fine, and the runtime for this case is well under a minute in python, so I do believe I must be on to something. But I still get the red cross, so there must be another (probably stupid) bug...
(I'm perhaps obfuscating too much here, don't want to get on the wrong side of the etiquette here...)
Cheers
Rodinio
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 261
No, the sum for 108 ends in 7.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
MrDrake
- Posts: 8
- Joined: Fri Oct 16, 2009 2:44 am
Re: Problem 261
This is really annoying... I have an algorithm that will solve it but would take too long, and I can't see how to really re-work it. 10^6 is taking a minute to get the correct answer (as opposed to a few seconds for the wrong one).
-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
Re: Problem 261
Finally got my missing part written so that my algorithm can work!
But curses, my algorithm runs in <1 second for 105, but I'm just shy of the correct amount (my result was juuuust lower than zwuupeape's result)... and brute force takes way too long. Time for a very lengthy debug time. *grumble*
But curses, my algorithm runs in <1 second for 105, but I'm just shy of the correct amount (my result was juuuust lower than zwuupeape's result)... and brute force takes way too long. Time for a very lengthy debug time. *grumble*
ex ~100%'er... until the gf came along.


-
zwuupeape
- Posts: 189
- Joined: Tue Jun 09, 2009 6:11 pm
Re: Problem 261
My incorrect algorithm is approximately O(sqrt(n)) time, I think. Well below one minute for 10^13 in unoptimized Python. Wonder how different that could be from everyone else's. Anyway, I hate that problem because I felt my 100% was near and it now seems further than ever 
-
quintana
- Posts: 11
- Joined: Wed Jan 28, 2009 5:53 pm
Re: Problem 261
finally! 10^6 in 15ms. beyond that c++ is helpless, due to overflow. back to java...
-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
Re: Problem 261
If it makes you feel any better, my 'O(sqrt(n))' algorithm took 3h42m to calculate in Python. Massively inefficient. It turns out there are a few odd side-cases one wouldn't normally expect (as everyone here seems to have noticed with their values being slightly low).
ex ~100%'er... until the gf came along.


-
zwuupeape
- Posts: 189
- Joined: Tue Jun 09, 2009 6:11 pm
Re: Problem 261
Got it !! 
Tricky and hard. A possible candidate, I think, for the hardest problem ever on PE, at least judging by the number of solvers so far ..
Tricky and hard. A possible candidate, I think, for the hardest problem ever on PE, at least judging by the number of solvers so far ..
-
quilan
- Posts: 182
- Joined: Fri Aug 03, 2007 11:08 pm
Re: Problem 261
I'm pretty sure 245 had lower by around this length... but it's pretty close.zwuupeape wrote:Got it !!
Tricky and hard. A possible candidate, I think, for the hardest problem ever on PE, at least judging by the number of solvers so far ..
ex ~100%'er... until the gf came along.


-
Rodinio
- Posts: 5
- Joined: Sat Oct 24, 2009 10:08 pm
Re: Problem 261
OK, I found one more (sparse) class of solutions so one more try:
Can someone confirm 10^7 -> 7835865568 ?
I'm stuck until I find a pattern to those special cases.
PS: I would really not mind seeing a correct solution for 10^8 either, Iknow I'm off (243296863635), but probably only one short... which would open the door to the next special case, I reckon.
Cheers
Rodinio
Can someone confirm 10^7 -> 7835865568 ?
I'm stuck until I find a pattern to those special cases.
PS: I would really not mind seeing a correct solution for 10^8 either, Iknow I'm off (243296863635), but probably only one short... which would open the door to the next special case, I reckon.
Cheers
Rodinio
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Problem 261
Both numbers are too low.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.