Problem 203

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Post Reply
ParadiceCity9
Posts: 15
Joined: Sat Dec 17, 2011 7:15 pm
Location: Charlottesville, Virginia

Problem 203

Post by ParadiceCity9 »

I've been working on Problem 203 (Problem 203 (View Problem)) and all seem good and well when my code worked just fine for the example they gave us (the first eight rows). I then ran my code for all 51 lines and alas, my answer was incorrect. Any idea what I could be missing? I'm using doubles for everything except the sum itself (for which I am using BigDecimal) so I feel like I should have enough bytes.
Last edited by ParadiceCity9 on Sun Mar 04, 2012 4:37 pm, edited 1 time in total.
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 203

Post by jaap »

ParadiceCity9 wrote:I've been working on Problem 203 (Problem 203 (View Problem)) and all seem good and well when my code worked good and well for the example they gave us (the first eight rows). I then ran my code for all 51 lines and alas, my answer was incorrect. Any idea what I could be missing? I'm using doubles for everything except the sum itself (for which I am using BigDecimal) so I feel like I should have enough bytes.
Your feeling is wrong. The largest binomial coefficient in the triangle is 50C25 which has 15 digits, and fits into a 64 bit long integer, but not into a double without loss of precision.
ParadiceCity9
Posts: 15
Joined: Sat Dec 17, 2011 7:15 pm
Location: Charlottesville, Virginia

Re: Problem 203

Post by ParadiceCity9 »

jaap wrote:
ParadiceCity9 wrote:I've been working on Problem 203 (Problem 203 (View Problem)) and all seem good and well when my code worked good and well for the example they gave us (the first eight rows). I then ran my code for all 51 lines and alas, my answer was incorrect. Any idea what I could be missing? I'm using doubles for everything except the sum itself (for which I am using BigDecimal) so I feel like I should have enough bytes.
Your feeling is wrong. The largest binomial coefficient in the triangle is 50C25 which has 15 digits, and fits into a 64 bit long integer, but not into a double without loss of precision.
Ahh, you were right. I got it, thanks!
User avatar
jake223
Posts: 61
Joined: Mon Apr 25, 2011 5:15 am
Location: USA
Contact:

Re: Problem 203

Post by jake223 »

Can anybody tell me where these figures start to go wrong? I get the right answer for the test case, and I am using BigIntegers, but the answer I get is wrong.

row 1 has 1. sum=1
row 2 has 1. sum=1
row 3 has 2. sum=3
row 4 has 3. sum=6
row 5 has 4. sum=12
row 6 has 6. sum=27
row 7 has 7. sum=42
row 8 has 10. sum=105
row 9 has 1*. sum=175
row 10 has 1*. sum=189
row 11 has 1*. sum=399
row 12 has 1*. sum=*422
row 13 has 2*. sum=*719
row 14 has 2*. sum=*383
row 15 has 3*. sum=*480
row 16 has 3*. sum=**410
row 17 has 3*. sum=**113
row 18 has 4*. sum=**098
row 19 has 4*. sum=**147
EDITED to remove (asterisked) results for rows 20-51
Last edited by jake223 on Fri Jun 29, 2012 2:12 am, edited 2 times in total.
Image
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 203

Post by rayfil »

... don't post any code fragments or results ...

I think you are pushing it a bit too far jake223.
When you assume something, you risk being wrong half the time.
Xtensor
Posts: 2
Joined: Wed Sep 02, 2020 5:51 am

Problem 203

Post by Xtensor »

I can't figure out what is wrong. At first glance, this problem is 5% difficult, but quickly one realizes that there is a "little matter" that makes the sums coincide up to a certain value, but from that value on, the sums do not coincide. Can someone give me a hint?
User avatar
RobertStanforth
Administrator
Posts: 2666
Joined: Mon Dec 30, 2013 11:25 pm

Re: Problem 203

Post by RobertStanforth »

Xtensor wrote: Sat Jan 29, 2022 6:16 am Can someone give me a hint?
The red banner text at the top of this page specifically asks you not to ask for hints.
Xtensor
Posts: 2
Joined: Wed Sep 02, 2020 5:51 am

Re: Problem 203

Post by Xtensor »

RobertStanforth wrote: Sat Jan 29, 2022 6:38 pm
Xtensor wrote: Sat Jan 29, 2022 6:16 am Can someone give me a hint?
The red banner text at the top of this page specifically asks you not to ask for hints.
I wasn't exactly asking for the solution, but for an indication of what is happening. But jaap gave me more or less the key point. Next time I'll ask the question in another way. Thank you.
User avatar
hk
Administrator
Posts: 12831
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 203

Post by hk »

The lesson you can take from this is to read the entire thread carefully because there might be a significant hint in it.
Image
War ruins the life and health of untold numbers of innocent children.
Post Reply