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.
vulcant
Posts: 2
Joined: Thu Aug 25, 2011 12:05 am

Re: Problem 008

Post by vulcant » Thu Aug 25, 2011 7:25 pm

Ah sorry about that. I'm using c++ currently.

pawanbcd
Posts: 3
Joined: Sun Jun 10, 2012 11:10 am

Problem 08

Post by pawanbcd » Sun Jun 10, 2012 11:15 am

Hello All,

I am not able to understand problem number 8.

My Understanding:

1) trying to find the 5 consecutive number (having the highest product) within this 1000 digit numbers.
2) say, i select (1-5) numbers, get it's product, then get(2-6) number and get it's product.... keep doing this thing till the end and always making a note of the highest number within them.

Am I right?

1) I just loop through the 1000 digits.
2) Get the 5 numbers from the array 1 by 1.
3) Get the product of the these number.
4) Compare the previous highest value with the present one .
....

EdoI
Posts: 1
Joined: Sun Jun 10, 2012 6:22 pm

Re: Problem 08

Post by EdoI » Sun Jun 10, 2012 6:23 pm

Well, have you tried that way? What result did you get?

User avatar
Usuario
Posts: 2
Joined: Mon May 28, 2012 5:12 am
Location: Argentina

Re: Problem 08

Post by Usuario » Sun Jun 10, 2012 8:30 pm

The answer is the product, not the 5 digit string

Ex: If you get that the string 12345 with product 120 has the greatest product, then the answer is 120 and NOT 12345

User avatar
rayfil
Administrator
Posts: 1401
Joined: Sun Mar 26, 2006 4:30 am
Location: Ontario, Canada
Contact:

Re: Problem 008

Post by rayfil » Mon Jun 11, 2012 3:30 am

@pawanbcd

We realize you are new to this forum. For problems under 100, the number is padded with leading 0's to make it a 3-digit number. This makes it easier for archiving and searching. By using this procedure, an answer to your question might already be available in previous posts.

You may also find useful information in the sticky topic entitled "Comments, questions and clarifications about PE problems".
When you assume something, you risk being wrong half the time.

pawanbcd
Posts: 3
Joined: Sun Jun 10, 2012 11:10 am

Re: Problem 08

Post by pawanbcd » Tue Jun 12, 2012 7:21 am

EdoI wrote:Well, have you tried that way? What result did you get?
Yes I tried this way and i get the answer as "28xx68" ( cannot tell the complete as per website rules ;-)).

It says it is wrong answer.

pawanbcd
Posts: 3
Joined: Sun Jun 10, 2012 11:10 am

Re: Problem 08

Post by pawanbcd » Tue Jun 12, 2012 7:25 am

Usuario wrote:The answer is the product, not the 5 digit string

Ex: If you get that the string 12345 with product 120 has the greatest product, then the answer is 120 and NOT 12345
Yes i got this point and i copied the product of the consecutive five number as my answer, My Answer is "Edited away by moderator" and the consecutive string i get is "Edited away by moderator"?

It tells the answer is wrong.

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 2:31 am

Re: Problem 008

Post by TripleM » Tue Jun 12, 2012 7:42 am

You should probably edit out even those figures, since searching for those partial strings really gives everything away.

Have you tried multiplying the digits you found by hand? I can't see how you possibly got the product you mentioned.

User avatar
jaap
Posts: 540
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 008

Post by jaap » Tue Jun 12, 2012 7:44 am

You do realise that the problem asks for the product of FIVE digits, don't you?

yasar
Posts: 3
Joined: Tue Jul 17, 2012 2:54 pm

Re: Problem 008

Post by yasar » Wed Aug 08, 2012 2:53 pm

hello all i started this problem a day ago i think my code should do what the problem asks but i keep getting the wrong answer :(

also guys what is the maximum size u can use an array with i.e

const int MAX = 50;
int array[MAX] ={};

i am asking because does the size alter calculation accuracy because im using a size of 250 to hold the numbers given in the problem.

rockstome
Posts: 17
Joined: Tue Sep 06, 2011 2:54 pm

Re: Problem 008

Post by rockstome » Wed Aug 08, 2012 4:10 pm

Why 250?
How many sets of five consecutive digits have 6-digit number?
Thanks for reply
Image

yasar
Posts: 3
Joined: Tue Jul 17, 2012 2:54 pm

Re: Problem 008

Post by yasar » Thu Aug 09, 2012 2:19 pm

i have none that = 6 digit number max is 5.

mega_unknown
Posts: 3
Joined: Sat Aug 25, 2012 9:28 pm

Problem 08

Post by mega_unknown » Sat Aug 25, 2012 9:38 pm

Dear Geek Friends, I'm new to project euler and I'm so happy to find such a place to tease my mind.
I just want someone to assure my understanding to the problem 08.
The idea behind problem 8 is to divide the whole string into sub-strings (200 Arrays) , each array is 5 consecutive characters from 0-999, then multiply Array's characters after converting each character to integer. Finally find the greatest product...
The Greatest Product is 31752.

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 2:31 am

Re: Problem 08

Post by TripleM » Sat Aug 25, 2012 9:46 pm

Please use existing problem threads: viewtopic.php?f=50&t=845

There are more than 200 possible 5-digit substrings of a 1000 digit string. 31671 is the second one.

User avatar
rayfil
Administrator
Posts: 1401
Joined: Sun Mar 26, 2006 4:30 am
Location: Ontario, Canada
Contact:

Re: Problem 008

Post by rayfil » Sun Aug 26, 2012 3:47 am

@mega_unknown :

For your info, problem numbers below 100 are padded with two 0's to make them 3-digit numbers.

Also for your info, starting with the first digit of the 1000-digit string having an index of 1, the first 5-digit substring would be digits 1-5; the next 5-digit substring would be digits 2-6; and so on. How many 5-digit substrings would there be in the 1000-digit string???
When you assume something, you risk being wrong half the time.

mega_unknown
Posts: 3
Joined: Sat Aug 25, 2012 9:28 pm

Re: Problem 008

Post by mega_unknown » Sun Aug 26, 2012 4:27 am

I feel so stupid through solving this problem...there is no complete explanation for this problem. :(
I beg the admin to rewrite this problem in humble way...I understood it in many ways and no one is correct.

Code: Select all

{snip}
Last edited by rayfil on Sun Aug 26, 2012 4:59 am, edited 1 time in total.
Reason: No code is allowed in this forum.

User avatar
rayfil
Administrator
Posts: 1401
Joined: Sun Mar 26, 2006 4:30 am
Location: Ontario, Canada
Contact:

Re: Problem 008

Post by rayfil » Sun Aug 26, 2012 5:09 am

@mega_unknown :

Please read again the big red banner at the top of the page when you make a post.

As for your request to rewrite the problem description, it has already been solved by well over 100,000 persons without any such request. It can be assumed that it is sufficiently clear.
When you assume something, you risk being wrong half the time.

mega_unknown
Posts: 3
Joined: Sat Aug 25, 2012 9:28 pm

Re: Problem 008

Post by mega_unknown » Sun Aug 26, 2012 11:51 am

Thanks rayfil , I have solved it couple seconds ago :D

pcworx
Posts: 6
Joined: Wed Nov 27, 2013 3:52 pm

Re: Problem 008

Post by pcworx » Tue Dec 24, 2013 7:14 pm

How did everyone grab the data off the number 008 site? I copied/pasted into idle (python) and I am getting syntax errors in the data also does the same when I grabbed data from source of the page.

Thanks

User avatar
rayfil
Administrator
Posts: 1401
Joined: Sun Mar 26, 2006 4:30 am
Location: Ontario, Canada
Contact:

Re: Problem 008

Post by rayfil » Fri Dec 27, 2013 1:10 am

If you grabbed it from the source page, you would have noticed that each line is terminated by a "<br />" (which is a code for the html page rendering to perform the carriage return/line feed) and would have been copied along with the remainder of the text numbers. You would have to remove those before processing the actual number.
If you grab it from the problem description, you probably get "carriage return/line feed" characters copied along with the numbers. Same as above before processing.
One trick might be to
- copy the latter first into a word processor such as Windows Note Pad,
- remove all the "carriage return/line feed" characters
- turn WordWrap OFF
- and grab only the resulting string of numbers.
When you assume something, you risk being wrong half the time.

Post Reply