<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Euler Problem 81</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-40003</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 24 Jun 2009 02:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-40003</guid>
		<description>&lt;p&gt;Josh -&lt;/p&gt;
&lt;p&gt;Tomorrow got to busy.  I put it up tonight.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Josh -</p>
<p>Tomorrow got to busy.  I put it up tonight.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-40000</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Tue, 23 Jun 2009 19:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-40000</guid>
		<description>&lt;p&gt;Michael,&lt;br&gt;
Thanks for the posting tips.  I&#039;ll keep my eyes open for petrw1, though he doesn&#039;t seem to be active anymore.  I&#039;ll wait for you to start the P83 thread and I&#039;ll use the time to clean up my code.&lt;/p&gt;
&lt;p&gt;Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael,<br />
Thanks for the posting tips.  I&#8217;ll keep my eyes open for petrw1, though he doesn&#8217;t seem to be active anymore.  I&#8217;ll wait for you to start the P83 thread and I&#8217;ll use the time to clean up my code.</p>
<p>Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39998</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 23 Jun 2009 18:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39998</guid>
		<description>&lt;p&gt;Hi Josh -&lt;/p&gt;
&lt;p&gt;Tomorrow night I&#039;ll try to post my VBA implementation of Doug&#039;s approach.  Please feel free to answer with your implementation.  We&#039;ll try to get all this Problem 83 stuff in a Problem 83 thread ;-)&lt;/p&gt;
&lt;p&gt;Note Dick&#039;s advice about posting code inside [ V B ] tags, and be watchful for angle bracket pairs inside the VB tags.  Wordpress treats those pairs as html and hides (throws away) anything in there.  Has the virtue of shortening your code ;-)  I use LT, GT, LTE, GTE and != for the angle brackets.&lt;/p&gt;
&lt;p&gt;Thanks for the steer on Graeme.  Another author to look for is petrw1.  He writes in BASIC.  If you DIM his variables and change his PRINT to debug.print, it&#039;ll usually run.  He&#039;s no good at telling you what his variables do, though.  &lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Josh -</p>
<p>Tomorrow night I&#8217;ll try to post my VBA implementation of Doug&#8217;s approach.  Please feel free to answer with your implementation.  We&#8217;ll try to get all this Problem 83 stuff in a Problem 83 thread <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Note Dick&#8217;s advice about posting code inside [ V B ] tags, and be watchful for angle bracket pairs inside the VB tags.  WordPress treats those pairs as html and hides (throws away) anything in there.  Has the virtue of shortening your code <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   I use LT, GT, LTE, GTE and != for the angle brackets.</p>
<p>Thanks for the steer on Graeme.  Another author to look for is petrw1.  He writes in BASIC.  If you DIM his variables and change his PRINT to debug.print, it&#8217;ll usually run.  He&#8217;s no good at telling you what his variables do, though.  </p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39995</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Tue, 23 Jun 2009 16:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39995</guid>
		<description>&lt;p&gt;Since the spreadsheet solutions seem to be well-documented, I&#039;ll describe my VBA method.  I used Dijkstra&#039;s pathfinding algorithm (good writeup with pseudocode on Wikipedia).  Dijkstra&#039;s is a rudimentary version of how mapfinding programs like Mapquest work.  The method is thus:  The points in the matrix are nodes, and the values are the distance (cost) to get to that node.  Set up a new 80×80 array with values initialized to infinity, except the top-left node to its actual value.  Mark all nodes as unvisited (I used an 80×80 array of booleans).&lt;br&gt;
The Main Loop:&lt;br&gt;
1.  Find the node with the lowest cost (upper-left to start).&lt;br&gt;
2.  For the current node, consider all unvisited neighbors and update the total if it is less than its current value.  For example, node (1,2) is initially set to infinity, but its new cost would be 4445+2697=7142, and node (2,1) would be 4445+1096=5541.&lt;br&gt;
3.  Mark the current node as visited.  This means it has the lowest possible value and is never considered again.  Thus, we never consider node (1,1) again.&lt;br&gt;
4.  If you&#039;re at your goal node, stop, print, cheer.  Otherwise, go back to step 1.&lt;/p&gt;
&lt;p&gt;My first attempt solved the problem in about 3s, but I noticed that about 98% of the time was finding the node with the current lowest cost, as in step 1.  Each time through, I was looping through all 6400 points, looking for the lowest value.  Obviously, an extreme waste of time.  After some searching, I decided to learn something new and use a priority queue in the form of a binary heap to always keep track of the node with the lowest cost.  I had a heck of a time fiddling with array indices, but eventually the answer came out in 0.1s.  I&#039;d be happy to post the code if anyone is interested.  I used basically the same code (without the priority queue) for 81 &amp; 82, only changing which nodes are considered as neighbors.  &lt;/p&gt;
&lt;p&gt;If you manage to solve a problem and you&#039;re looking at the forum posts for insight, then I recommend that you look for postings by a user named GraemeMcRae.  He does the problems with spreadsheet / VBA.  His solutions are concise, highly readable, and thoroughly explained.  He also appears to have a strong math background and does a good job with explanations.  I&#039;ve learned quite a bit from him.&lt;/p&gt;
&lt;p&gt;-Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Since the spreadsheet solutions seem to be well-documented, I&#8217;ll describe my VBA method.  I used Dijkstra&#8217;s pathfinding algorithm (good writeup with pseudocode on Wikipedia).  Dijkstra&#8217;s is a rudimentary version of how mapfinding programs like Mapquest work.  The method is thus:  The points in the matrix are nodes, and the values are the distance (cost) to get to that node.  Set up a new 80×80 array with values initialized to infinity, except the top-left node to its actual value.  Mark all nodes as unvisited (I used an 80×80 array of booleans).<br />
The Main Loop:<br />
1.  Find the node with the lowest cost (upper-left to start).<br />
2.  For the current node, consider all unvisited neighbors and update the total if it is less than its current value.  For example, node (1,2) is initially set to infinity, but its new cost would be 4445+2697=7142, and node (2,1) would be 4445+1096=5541.<br />
3.  Mark the current node as visited.  This means it has the lowest possible value and is never considered again.  Thus, we never consider node (1,1) again.<br />
4.  If you&#8217;re at your goal node, stop, print, cheer.  Otherwise, go back to step 1.</p>
<p>My first attempt solved the problem in about 3s, but I noticed that about 98% of the time was finding the node with the current lowest cost, as in step 1.  Each time through, I was looping through all 6400 points, looking for the lowest value.  Obviously, an extreme waste of time.  After some searching, I decided to learn something new and use a priority queue in the form of a binary heap to always keep track of the node with the lowest cost.  I had a heck of a time fiddling with array indices, but eventually the answer came out in 0.1s.  I&#8217;d be happy to post the code if anyone is interested.  I used basically the same code (without the priority queue) for 81 &amp; 82, only changing which nodes are considered as neighbors.  </p>
<p>If you manage to solve a problem and you&#8217;re looking at the forum posts for insight, then I recommend that you look for postings by a user named GraemeMcRae.  He does the problems with spreadsheet / VBA.  His solutions are concise, highly readable, and thoroughly explained.  He also appears to have a strong math background and does a good job with explanations.  I&#8217;ve learned quite a bit from him.</p>
<p>-Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39992</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 23 Jun 2009 15:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39992</guid>
		<description>&lt;p&gt;Hi Stephen -&lt;/p&gt;
&lt;p&gt;In the spirit of Project Euler, we try not to post the answers, particularly the right ones ;-).  So, Euler forgive us...&lt;/p&gt;
&lt;p&gt;If you join Project Euler (http://projecteuler.net/index.php), when you then further click on a problem, there is a submit button.  Submitting your answer will either come back with a nice apology that &quot;We&#039;re sorry, but your answer appears to be incorrect...&quot; or a check mark and admission into the often-locked discussion group with those that have also solved the problem.  Occasionally, there is also a pdf file that provides more insight.  Most solutions offered on the inside are written in obfuscated code, usually Python, and often by high-schoolers.  But there are a few gems among the pebbles.  An author named &quot;rayfil&quot; does the problems in assembly, and while there are some BASIC authors, not many, if any at all, post VBA.  That&#039;s what led me to ask Dick if I could post here.&lt;/p&gt;
&lt;p&gt;Doug Jenkins beat you to it and did exactly your spreadsheet solution in the 123 thread.  That&#039;s were I first brought up my #83 ineptitude.&lt;/p&gt;
&lt;p&gt;The number of apologies I&#039;ve received greatly exceeds the number of checkmarks...&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Stephen -</p>
<p>In the spirit of Project Euler, we try not to post the answers, particularly the right ones <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .  So, Euler forgive us&#8230;</p>
<p>If you join Project Euler (<a href="http://projecteuler.net/index.php" rel="nofollow">http://projecteuler.net/index.php</a>), when you then further click on a problem, there is a submit button.  Submitting your answer will either come back with a nice apology that &#8220;We&#8217;re sorry, but your answer appears to be incorrect&#8230;&#8221; or a check mark and admission into the often-locked discussion group with those that have also solved the problem.  Occasionally, there is also a pdf file that provides more insight.  Most solutions offered on the inside are written in obfuscated code, usually Python, and often by high-schoolers.  But there are a few gems among the pebbles.  An author named &#8220;rayfil&#8221; does the problems in assembly, and while there are some BASIC authors, not many, if any at all, post VBA.  That&#8217;s what led me to ask Dick if I could post here.</p>
<p>Doug Jenkins beat you to it and did exactly your spreadsheet solution in the 123 thread.  That&#8217;s were I first brought up my #83 ineptitude.</p>
<p>The number of apologies I&#8217;ve received greatly exceeds the number of checkmarks&#8230;</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bullen</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39990</link>
		<dc:creator>Stephen Bullen</dc:creator>
		<pubDate>Tue, 23 Jun 2009 14:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39990</guid>
		<description>&lt;p&gt;If 4****5 is the right answer, a Tushar solution is:&lt;br&gt;
 - Import the matrix into B2:CC81 (i.e. with a blank row above and left of it)&lt;br&gt;
 - In B83: =B2&lt;br&gt;
 - In C83: =MIN(C82,B83,C84,D83)+C2&lt;br&gt;
 - Turn on iteration and set max to 1000 or so (100 might not be enough!)&lt;br&gt;
 - Copy C83 to the rest of an 80×80 grid and watch it iterate&lt;br&gt;
 - CC162 has the answer&lt;/p&gt;
&lt;p&gt;(Edited by Michael to conceal the answer)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If 4****5 is the right answer, a Tushar solution is:<br />
 &#8211; Import the matrix into B2:CC81 (i.e. with a blank row above and left of it)<br />
 &#8211; In B83: =B2<br />
 &#8211; In C83: =MIN(C82,B83,C84,D83)+C2<br />
 &#8211; Turn on iteration and set max to 1000 or so (100 might not be enough!)<br />
 &#8211; Copy C83 to the rest of an 80×80 grid and watch it iterate<br />
 &#8211; CC162 has the answer</p>
<p>(Edited by Michael to conceal the answer)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bullen</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39989</link>
		<dc:creator>Stephen Bullen</dc:creator>
		<pubDate>Tue, 23 Jun 2009 13:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39989</guid>
		<description>&lt;p&gt;Re #83: I have some code that does the sample and gives *a* result for the 80×80 matrix (4****5), but how do I know if it&#039;s the right answer?&lt;/p&gt;
&lt;p&gt;(Edited by Michael to conceal the answer)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Re #83: I have some code that does the sample and gives *a* result for the 80×80 matrix (4****5), but how do I know if it&#8217;s the right answer?</p>
<p>(Edited by Michael to conceal the answer)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39988</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 23 Jun 2009 13:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39988</guid>
		<description>&lt;p&gt;Hi Tushar -&lt;/p&gt;
&lt;p&gt;;-)  Yep, never said it was hard.  Except for the order of cells in the MIN() that was exactly my approach, down to having the answer is A101.  Must have been looking over my shoulder... ;-)  Nicely, the MIN() ignores empty cells beyond the boundaries.  In VBA I got out-of-range errors.  That necessitated the early rollups of the right and bottom.&lt;/p&gt;
&lt;p&gt;Now, #82 and #83 (using the same matrix) are tougher.  See Doug&#039;s iterative spreadsheet solution in the 123 thread for #83.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Tushar -</p>
<p> <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   Yep, never said it was hard.  Except for the order of cells in the MIN() that was exactly my approach, down to having the answer is A101.  Must have been looking over my shoulder&#8230; <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   Nicely, the MIN() ignores empty cells beyond the boundaries.  In VBA I got out-of-range errors.  That necessitated the early rollups of the right and bottom.</p>
<p>Now, #82 and #83 (using the same matrix) are tougher.  See Doug&#8217;s iterative spreadsheet solution in the 123 thread for #83.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/20/euler-problem-81/#comment-39986</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Tue, 23 Jun 2009 07:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2607#comment-39986</guid>
		<description>&lt;p&gt;Michael wrote: &quot;#81 can absolutely be done in a spreadsheet, as Tushar shows here for numbers 18 and 67?&lt;/p&gt;
&lt;p&gt;LOL!  Yes, Euler 81 is trivial to solve in Excel.  Suppose the matrix is in A1:CB80.&lt;/p&gt;
&lt;p&gt;In CB180 enter =CB80+MIN(CB181,CC180).  Copy it to A180:CA180.  Copy A180:CB180 to rows 101:179.  A101 will have the desired answer.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael wrote: &#8220;#81 can absolutely be done in a spreadsheet, as Tushar shows here for numbers 18 and 67?</p>
<p>LOL!  Yes, Euler 81 is trivial to solve in Excel.  Suppose the matrix is in A1:CB80.</p>
<p>In CB180 enter =CB80+MIN(CB181,CC180).  Copy it to A180:CA180.  Copy A180:CB180 to rows 101:179.  A101 will have the desired answer.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

