Problem 008

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.
skoczian
Posts: 28
Joined: Sat May 25, 2013 4:43 pm

Re: Problem 008

Post 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).
SawyerWest
Posts: 3
Joined: Wed May 13, 2020 5:46 pm

Re: Problem 008

Post 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.
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 008

Post 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.
When you assume something, you risk being wrong half the time.
glockr
Posts: 2
Joined: Sat Oct 28, 2023 9:21 am

Re: Problem 008

Post 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?
DJohn
Posts: 90
Joined: Sat Oct 11, 2008 12:24 pm

Re: Problem 008

Post 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.
glockr
Posts: 2
Joined: Sat Oct 28, 2023 9:21 am

Re: Problem 008

Post 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... :(
Post Reply