Problem 011
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.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
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
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.
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 011
Cruncher2
Send me a PM with your latest answer, where you found it, and a brief description of your algo.
Send me a PM with your latest answer, where you found it, and a brief description of your algo.
When you assume something, you risk being wrong half the time.
-
slindeneau
- Posts: 4
- Joined: Thu Jun 16, 2011 12:34 am
Re: Problem 011
I am not saying that the problem as a whole is not straightforward. What i am saying is that the title of the problem and body of the problem differ.problem 11 is straightforward ,if over 50k people solved it there should be no problem with the problem
It would be nice if they said the same thing.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 011
I added the word 'adjacent' to the title.

War ruins the life and health of untold numbers of innocent children.
-
dracomage94
- Posts: 1
- Joined: Wed Jul 06, 2011 4:07 am
Problem 11
in problem 11, we have the following grid:
snip
the four bolded numbers give snip = snip, larger than the supposedly "correct" answer
the four numbers clearly are diagonally adjacent to one another, so why is that answer not valid?
snip
the four bolded numbers give snip = snip, larger than the supposedly "correct" answer
Expand
Last edited by rayfil on Thu Jul 07, 2011 1:42 am, edited 1 time in total.
Reason: This is an open forum and results nor code for published problems should be posted.
Reason: This is an open forum and results nor code for published problems should be posted.
-
Hibernatus34
- Posts: 31
- Joined: Mon May 16, 2011 7:03 am
Re: Problem 11
They're not on the same line.
Now please remove your spoiler from this forum.
Now please remove your spoiler from this forum.
Joined PE in May 2011- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 11
dracomage94
I realize this is your first post on this forum. Please note that there is a specific area for questions related to existing published problems, i.e. Project Euler Problems which you would find just above the Suggestions and FAQ section you used. For your information, the problem numbers are padded with leading 0's for ease of searching.
This post has thus been merged with its proper topic.
I realize this is your first post on this forum. Please note that there is a specific area for questions related to existing published problems, i.e. Project Euler Problems which you would find just above the Suggestions and FAQ section you used. For your information, the problem numbers are padded with leading 0's for ease of searching.
This post has thus been merged with its proper topic.
When you assume something, you risk being wrong half the time.
-
Inglonias
- Posts: 5
- Joined: Tue Feb 15, 2011 12:42 pm
Re: Problem 011
I did it using an algorithm that I originally developed to check if somebody won a game of Connect Four. The proudest part of my program, though, was that I used the Scanner class (java) to put in the grid of numbers without typing it myself. Oh, that was fun. I typed in one row manually, and I thought "Nope! Nope! Not doing this 19 more times."
- jaap
- Posts: 588
- Joined: Tue Mar 25, 2008 3:57 pm
- Contact:
Re: Problem 011
There is no need to type it all in. I just copy/pasted them from the Euler page into my text editor, did a search & replace to change spaces to commas and to remove the leading zeroes, and then pasted that into my program code to use as an array initialiser.Inglonias wrote:I did it using an algorithm that I originally developed to check if somebody won a game of Connect Four. The proudest part of my program, though, was that I used the Scanner class (java) to put in the grid of numbers without typing it myself. Oh, that was fun. I typed in one row manually, and I thought "Nope! Nope! Not doing this 19 more times."
-
Bajinga
- Posts: 3
- Joined: Sun Aug 28, 2011 11:20 pm
Re: Problem 011 Clarification
Sorry for bringing up such an easy question, but I was worried about this:
Take the first four lines of the matrix:
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
If going diagonally, would it be safe to say that this would be one of the diagonals?
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
Take the first four lines of the matrix:
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
If going diagonally, would it be safe to say that this would be one of the diagonals?
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
0100001001100101011011100010000001000100011101
0101101110011000110110000101101110
42656E2044756E63616E
Ben Duncan
0101101110011000110110000101101110
42656E2044756E63616E
Ben Duncan
-
TripleM
- Posts: 384
- Joined: Fri Sep 12, 2008 3:31 am
-
Bajinga
- Posts: 3
- Joined: Sun Aug 28, 2011 11:20 pm
Re: Problem 011
Ah, thank you!
0100001001100101011011100010000001000100011101
0101101110011000110110000101101110
42656E2044756E63616E
Ben Duncan
0101101110011000110110000101101110
42656E2044756E63616E
Ben Duncan
-
starcraft.man
- Posts: 1
- Joined: Sun Jun 17, 2012 12:28 pm
Re: Problem 011
The text for this problem really should be more specific. I thought this problem was to solve for four connected adjacent nodes in ANY direction (i.e. not necessarily the same). I built a nice Graph data structure and the algorithms needed to solve that. Now I'm kind of dissapointed that I over complicated it.
Doesn't seem like I'm the first to misread either.
Doesn't seem like I'm the first to misread either.
-
omars1515
- Posts: 1
- Joined: Sat Dec 15, 2012 9:25 pm
Re: Problem 011
First time poster like the person above, and I also felt I disappointed in the time spent figuring out the ambiguity.
Edit: Problem states numbers are "on the same straight line," but that's on the LINK. Didn't think there was useful information in the link.
Why should we have to go "back" in our browser to see additional information? WHY???
Edit: Problem states numbers are "on the same straight line," but that's on the LINK. Didn't think there was useful information in the link.
Why should we have to go "back" in our browser to see additional information? WHY???
- euler
- Administrator
- Posts: 5095
- Joined: Sun Mar 05, 2006 4:49 pm
- Location: Cheshire, England
- Contact:
Re: Problem 011
Why the loud why?omars1515 wrote:WHY???
Good point, though. I've modified the wording from,
"What is the greatest product of four adjacent numbers in any direction (up, down, left, right, or diagonally) in the 20×20 grid?"
to,
"What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?"
Does that scratch the itch or does it need more?

impudens simia et macrologus profundus fabulae
-
vkartik
- Posts: 1
- Joined: Mon Aug 19, 2013 3:54 am
Re: Problem 011
Am I missing something here ? I'm iterating through all the values of the 2-D array and considering each array element as origin I find 4 element rows(left,right), 4 element columns(up,down),four diagonals in each quadrant relative to the origin. I believe I covered possible cases here. I'm getting a value of 64564558. Can someone please provide me with a hint/clarification if i am missing anything ?
Thanks!
P.S. I solved it, I was right all along. Had a wrong index (i1,j1) (i1,j2) (i3,j3) (i4,j4) for diagonal (same repeated wrong index , cropped up from copy pasting from rows code)
Thanks!
P.S. I solved it, I was right all along. Had a wrong index (i1,j1) (i1,j2) (i3,j3) (i4,j4) for diagonal (same repeated wrong index , cropped up from copy pasting from rows code)
Last edited by vkartik on Mon Aug 19, 2013 8:33 pm, edited 2 times in total.
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 011
@vkartik
Even though it may be your first post in this forum, you should have read that big RED banner before posting. It clearly warns against posting ANY CODE.
Even though it may be your first post in this forum, you should have read that big RED banner before posting. It clearly warns against posting ANY CODE.
When you assume something, you risk being wrong half the time.
-
sh42
- Posts: 2
- Joined: Tue Dec 17, 2013 4:58 pm
Re: Problem 011
Hello to you all.
I'm looking forward to the Problem 11, yet I'm still a bit lost.
At the moment the description is as follows:
That's what I'm getting at. Is that correct?
Love the site, love the problems!
Thank you all.
sh42
I'm looking forward to the Problem 11, yet I'm still a bit lost.
At the moment the description is as follows:
Sorry if I'm causing any more confusion on this, but does that mean I have to check all the products of all adjacent numbers in all the possible directions? (Wouldn't pose a problem for me) and check the products against one another?The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?
That's what I'm getting at. Is that correct?
Love the site, love the problems!
Thank you all.
sh42
- TheEvil
- Posts: 84
- Joined: Sun Nov 13, 2011 10:38 am
- Location: Szeged, Hungary
-
sh42
- Posts: 2
- Joined: Tue Dec 17, 2013 4:58 pm
Re: Problem 011
Got it, thanksTheEvil wrote:If you do that, you will definitely get the green tick.
-
loucat
- Posts: 1
- Joined: Thu Jan 09, 2014 8:00 pm
Re: Problem 011
I've just solved this problem but I still find the description very misleading and I had to read all this thread to actually understand it.
This is the current text:
"The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?"
To me it seems obvious that "in the same direction" is related to the direction of "26 × 63 × 78 × 14", and not at all obvious that we should check all the possible directions...
I would specify this better, saying "horizontal, vertical, 2 diagonal directions" or maybe saying "all directions where the 4 numbers are adjacent and aligned".
just a suggestion
This is the current text:
"The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?"
To me it seems obvious that "in the same direction" is related to the direction of "26 × 63 × 78 × 14", and not at all obvious that we should check all the possible directions...
I would specify this better, saying "horizontal, vertical, 2 diagonal directions" or maybe saying "all directions where the 4 numbers are adjacent and aligned".
just a suggestion

