Page 2 of 6

Re: Problem 008

Posted: Thu Aug 25, 2011 8:25 pm
by vulcant
Ah sorry about that. I'm using c++ currently.

Problem 08

Posted: Sun Jun 10, 2012 12:15 pm
by pawanbcd
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 .
....

Re: Problem 08

Posted: Sun Jun 10, 2012 7:23 pm
by EdoI
Well, have you tried that way? What result did you get?

Re: Problem 08

Posted: Sun Jun 10, 2012 9:30 pm
by Usuario
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

Re: Problem 008

Posted: Mon Jun 11, 2012 4:30 am
by rayfil
@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".

Re: Problem 08

Posted: Tue Jun 12, 2012 8:21 am
by pawanbcd
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.

Re: Problem 08

Posted: Tue Jun 12, 2012 8:25 am
by pawanbcd
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.

Re: Problem 008

Posted: Tue Jun 12, 2012 8:42 am
by TripleM
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.

Re: Problem 008

Posted: Tue Jun 12, 2012 8:44 am
by jaap
You do realise that the problem asks for the product of FIVE digits, don't you?

Re: Problem 008

Posted: Wed Aug 08, 2012 3:53 pm
by yasar
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.

Re: Problem 008

Posted: Wed Aug 08, 2012 5:10 pm
by rockstome
Why 250?
How many sets of five consecutive digits have 6-digit number?

Re: Problem 008

Posted: Thu Aug 09, 2012 3:19 pm
by yasar
i have none that = 6 digit number max is 5.

Problem 08

Posted: Sat Aug 25, 2012 10:38 pm
by mega_unknown
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.

Re: Problem 08

Posted: Sat Aug 25, 2012 10:46 pm
by TripleM
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.

Re: Problem 008

Posted: Sun Aug 26, 2012 4:47 am
by rayfil
@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???

Re: Problem 008

Posted: Sun Aug 26, 2012 5:27 am
by mega_unknown
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}

Re: Problem 008

Posted: Sun Aug 26, 2012 6:09 am
by rayfil
@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.

Re: Problem 008

Posted: Sun Aug 26, 2012 12:51 pm
by mega_unknown
Thanks rayfil , I have solved it couple seconds ago :D

Re: Problem 008

Posted: Tue Dec 24, 2013 7:14 pm
by pcworx
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

Re: Problem 008

Posted: Fri Dec 27, 2013 1:10 am
by rayfil
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.