Page 6 of 6
Re: Problem 008
Posted: Wed May 13, 2020 8:17 pm
by skoczian
SawyerWest wrote: Wed May 13, 2020 8:06 pm
For some reason my program is finding the correct answer for 1, 2, 3, and 4 adjacent digits (I've tested) but for some reason not 13 digits (although it looks fine)? Am I allowed to post results for input != 13 to discuss?
If you look through this thread you will see that this is quite a frequent difficulty and you will find the most probable solution. Moreover it won't be the last time this may bite you (depends on the programming language you use).
Re: Problem 008
Posted: Wed May 13, 2020 8:43 pm
by SawyerWest
skoczian wrote: Wed May 13, 2020 8:17 pm
SawyerWest wrote: Wed May 13, 2020 8:06 pm
For some reason my program is finding the correct answer for 1, 2, 3, and 4 adjacent digits (I've tested) but for some reason not 13 digits (although it looks fine)? Am I allowed to post results for input != 13 to discuss?
If you look through this thread you will see that this is quite a frequent difficulty and you will find the most probable solution. Moreover it won't be the last time this may bite you (depends on the programming language you use).
I understand a lot of people are having trouble understanding what the problem is asking, but that is not the case here.
"The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832."
[removed by moderator]
Last warning.
Please stop with posting way too much
[/removed]
To moderator: Sorry about that, I didn't mean to cause a problem.
Re: Problem 008
Posted: Thu May 14, 2020 3:33 pm
by rayfil
I know that there are 6 pages related to this particular problem but you were not aware of them before your first comment. Problem numbers need to be padded up front with 0's for easier search.
Conclusion: Many others have had their comments/questions, and possible answers to them.
Suggestion: Go through all of them and you should eventually find an answer to your own query. Simply consider it as another type of problem solving. This is how you become a better programmer.
Re: Problem 008
Posted: Sat Oct 28, 2023 9:39 am
by glockr
I realize this is an old thread, but I'm having a hard time understanding why the "correct" answer on the problem page was arrived at. My answer came out quite a bit higher than the "official correct answer." At first I thought my code was wrong, but when I added some debugging output, I found there are a few groups of 13 consecutive digits that have a product that is larger than the "official correct answer." I manually checked this by verifying the digits on the Problem 008 page and running them through a calculator. Am I misreading the problem? It's taking any 13 consecutive digits and multiplying all 13 to get a product, correct?
Re: Problem 008
Posted: Sat Oct 28, 2023 5:31 pm
by DJohn
glockr wrote: Sat Oct 28, 2023 9:39 amI found there are a few groups of 13 consecutive digits that have a product that is larger than the "official correct answer." I manually checked this by verifying the digits on the Problem 008 page and running them through a calculator. Am I misreading the problem? It's taking any 13 consecutive digits and multiplying all 13 to get a product, correct?
It is taking 13 consecutive digits and multiplying them together, yes. You might be reading the 1000 digit number as a rectangular array of digits, and reading adjacent digits in other directions. It is not a rectangular array - it's just displayed that way because not many of us have monitors wide enough to show it all on one line. It's a 1000 digit number. The first 7 is consecutive with the 3 to its right, and not with the 9 below it. Also, the 3 at the end of the second line is consecutive with the 8 at the start of the next line as well as the 4 to its left.
Re: Problem 008
Posted: Sat Oct 28, 2023 6:17 pm
by glockr
DJohn wrote: Sat Oct 28, 2023 5:31 pm
glockr wrote: Sat Oct 28, 2023 9:39 amI found there are a few groups of 13 consecutive digits that have a product that is larger than the "official correct answer." I manually checked this by verifying the digits on the Problem 008 page and running them through a calculator. Am I misreading the problem? It's taking any 13 consecutive digits and multiplying all 13 to get a product, correct?
I found the problem - the data type I was using was too small so it was truncating the products. Then on top of that I miscounted the digits in my result, which was actually smaller than the correct result, not larger. DANG - first post and I screwed it up bad. Hanging my head in shame...
