<?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 123</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/</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/15/euler-problem-123/#comment-39983</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 23 Jun 2009 03:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39983</guid>
		<description>&lt;p&gt;Hi Josh -&lt;/p&gt;
&lt;p&gt;I set up Doug&#039;s example (actually both of them) and I don&#039;t which is the greater insight:  to create a second matrix or to iterate.  Neat stuff.&lt;/p&gt;
&lt;p&gt;I did something wrong...it takes me 4(!) loops to do the first, and interestingly, 5 to do the second.  That turns out to be when the lower right is stable.  Maybe Doug knows why the difference.  It takes 11 or 12 tries before everything is stable.&lt;/p&gt;
&lt;p&gt;I coded up the second method.  The seeding Doug mentioned is important.  When I did it badly, it took over a minute to calculate and 1218 loops.  With the seeds, 3/10&#039;s of a second, and those 5 loops.  I&#039;ll post it when I get the time.  Needs some cleanup.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Josh -</p>
<p>I set up Doug&#8217;s example (actually both of them) and I don&#8217;t which is the greater insight:  to create a second matrix or to iterate.  Neat stuff.</p>
<p>I did something wrong&#8230;it takes me 4(!) loops to do the first, and interestingly, 5 to do the second.  That turns out to be when the lower right is stable.  Maybe Doug knows why the difference.  It takes 11 or 12 tries before everything is stable.</p>
<p>I coded up the second method.  The seeding Doug mentioned is important.  When I did it badly, it took over a minute to calculate and 1218 loops.  With the seeds, 3/10&#8242;s of a second, and those 5 loops.  I&#8217;ll post it when I get the time.  Needs some cleanup.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39976</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Mon, 22 Jun 2009 15:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39976</guid>
		<description>&lt;p&gt;I am truly amazed at many of the spreadsheet-only solutions that people post.  My first instinct is generally to go straight to VBA, and setting up circular references in the spreadsheet never would have occurred to me.  I used the (Named) Algorithm also used by many other people in the PE forum and while I learned a new algorithm, I think I would have learned more about Excel from the above method.  Now to attempt to wrap my mind around the above method...&lt;/p&gt;
&lt;p&gt;-Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I am truly amazed at many of the spreadsheet-only solutions that people post.  My first instinct is generally to go straight to VBA, and setting up circular references in the spreadsheet never would have occurred to me.  I used the (Named) Algorithm also used by many other people in the PE forum and while I learned a new algorithm, I think I would have learned more about Excel from the above method.  Now to attempt to wrap my mind around the above method&#8230;</p>
<p>-Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39955</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sat, 20 Jun 2009 20:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39955</guid>
		<description>&lt;p&gt;Hi Doug -&lt;/p&gt;
&lt;p&gt;Thank you.  It truly never occurred to me that I wanted to be in loop like that.  My strategy was to weight the cell I was in so heavily that it would never again be a minimum, and never again visited.&lt;/p&gt;
&lt;p&gt;I didn&#039;t succeed.  Many times ;-)&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Doug -</p>
<p>Thank you.  It truly never occurred to me that I wanted to be in loop like that.  My strategy was to weight the cell I was in so heavily that it would never again be a minimum, and never again visited.</p>
<p>I didn&#8217;t succeed.  Many times <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39950</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Sat, 20 Jun 2009 17:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39950</guid>
		<description>&lt;p&gt;Michael - I just looked at the Project Euler forum and see that the first correct solution used Excel, using essentially the same method as I described.&lt;/p&gt;
&lt;p&gt;One simplification is that the Min function ignores blank cells, so you can in fact use the same formula all over, and don&#039;t need to adjust it for the edges and corners, or enter big numbers all around the boundaries.&lt;/p&gt;
&lt;p&gt;My method has one improvement in that I initially use a specified cell, with non-circular references, to seed the values used in the circular references, rather than using the circular reference from the first iteration.  This converges much more rapidly (i.e. 3 iterations, rather than hundreds).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael &#8211; I just looked at the Project Euler forum and see that the first correct solution used Excel, using essentially the same method as I described.</p>
<p>One simplification is that the Min function ignores blank cells, so you can in fact use the same formula all over, and don&#8217;t need to adjust it for the edges and corners, or enter big numbers all around the boundaries.</p>
<p>My method has one improvement in that I initially use a specified cell, with non-circular references, to seed the values used in the circular references, rather than using the circular reference from the first iteration.  This converges much more rapidly (i.e. 3 iterations, rather than hundreds).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39948</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sat, 20 Jun 2009 15:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39948</guid>
		<description>&lt;p&gt;Hi Doug -&lt;/p&gt;
&lt;p&gt;Yep. It&#039;s those circular references that I can&#039;t get my mind around.  Thanks for showing an approach.  It certainly ought to be doable in a spreadsheet!&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Doug -</p>
<p>Yep. It&#8217;s those circular references that I can&#8217;t get my mind around.  Thanks for showing an approach.  It certainly ought to be doable in a spreadsheet!</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39947</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Sat, 20 Jun 2009 11:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39947</guid>
		<description>&lt;p&gt;I did problem 83 with VBA (which I&#039;m not going to post because the code is a mess), then it occurred to me that it could be done neatly using a simple circular reference.&lt;/p&gt;
&lt;p&gt;The procedure is:&lt;br&gt;
1. Open the data as a worksheet (re-name matrix.txt to matrix.csv is a quick way)&lt;br&gt;
2. Insert a blank column to the left, and blank row above the data, so the data range is B2:CC81&lt;br&gt;
3. Set up the worksheet to allow iterative calculation, with 1 iteration, and set calculation to manual.&lt;br&gt;
4. In cell A83 enter 0.&lt;br&gt;
5. Set up an 80×80 table (say in B85:CC164) below the matrix  containing the minimum sum to reach any cell:&lt;br&gt;
  in cell B85 enter +B2&lt;br&gt;
  In cell C86: =+C3+IF($A$83,MIN(B86,C85,D86,C87),B86)&lt;br&gt;
  Copy C86 to C86:CB163&lt;br&gt;
  In cell C85:  =+C2+IF($A$83,MIN(B85,D85,C86),B85)  Copy to C85:CB85&lt;br&gt;
  In cell CC85:  =+CC2+IF($A$83,MIN(CB85,CD85),CB85)&lt;br&gt;
  In cell B86:  =+B3+IF($A$83,MIN(B85,C86,B87),B85)  Copy to B86:B163&lt;br&gt;
  In cell B164:  =+B81+IF($A$83,MIN(B163,C164),B163)&lt;br&gt;
  In cell C164:  =+C81+IF($A$83,MIN(B164,C163,D164),B164)  Copy to C164:CB164&lt;br&gt;
  In cell CC86:  =+CC3+IF($A$83,MIN(CB86,CC85,CC87),CB86)  Copy to CC86:CC163&lt;br&gt;
  In cell CC164:  =+CC81+IF($A$83,MIN(CB164,CC163),CB164)&lt;br&gt;
6: Press F9, then enter 1 in cell A83&lt;br&gt;
7: Press F9 (calc) three times.&lt;br&gt;
8:  The answer is in cell CC164&lt;/p&gt;
&lt;p&gt;An alternative would be to enter a large number (say 1,000,000) in the columns and rows around the range B85:CC164, then use the same formula (as in C86) everywhere except B85.&lt;/p&gt;
&lt;p&gt;My VBA essentially used the same technique, and solved near instantaneously.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I did problem 83 with VBA (which I&#8217;m not going to post because the code is a mess), then it occurred to me that it could be done neatly using a simple circular reference.</p>
<p>The procedure is:<br />
1. Open the data as a worksheet (re-name matrix.txt to matrix.csv is a quick way)<br />
2. Insert a blank column to the left, and blank row above the data, so the data range is B2:CC81<br />
3. Set up the worksheet to allow iterative calculation, with 1 iteration, and set calculation to manual.<br />
4. In cell A83 enter 0.<br />
5. Set up an 80×80 table (say in B85:CC164) below the matrix  containing the minimum sum to reach any cell:<br />
  in cell B85 enter +B2<br />
  In cell C86: =+C3+IF($A$83,MIN(B86,C85,D86,C87),B86)<br />
  Copy C86 to C86:CB163<br />
  In cell C85:  =+C2+IF($A$83,MIN(B85,D85,C86),B85)  Copy to C85:CB85<br />
  In cell CC85:  =+CC2+IF($A$83,MIN(CB85,CD85),CB85)<br />
  In cell B86:  =+B3+IF($A$83,MIN(B85,C86,B87),B85)  Copy to B86:B163<br />
  In cell B164:  =+B81+IF($A$83,MIN(B163,C164),B163)<br />
  In cell C164:  =+C81+IF($A$83,MIN(B164,C163,D164),B164)  Copy to C164:CB164<br />
  In cell CC86:  =+CC3+IF($A$83,MIN(CB86,CC85,CC87),CB86)  Copy to CC86:CC163<br />
  In cell CC164:  =+CC81+IF($A$83,MIN(CB164,CC163),CB164)<br />
6: Press F9, then enter 1 in cell A83<br />
7: Press F9 (calc) three times.<br />
8:  The answer is in cell CC164</p>
<p>An alternative would be to enter a large number (say 1,000,000) in the columns and rows around the range B85:CC164, then use the same formula (as in C86) everywhere except B85.</p>
<p>My VBA essentially used the same technique, and solved near instantaneously.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39926</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Thu, 18 Jun 2009 18:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39926</guid>
		<description>&lt;p&gt;Hi Josh -&lt;/p&gt;
&lt;p&gt;I have done #81.  I&#039;ll post it this weekend, and give you a chance to chime in there.  My approach was basically the same as I used for #67 to do #81, swapping min for max, but moving it on to #83 eludes me at the moment.  &lt;/p&gt;
&lt;p&gt;So thanks, and stay tuned!&lt;/p&gt;
&lt;p&gt;...mrt (who was just waiting for fzz to write a sieve for him ;-) )&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Josh -</p>
<p>I have done #81.  I&#8217;ll post it this weekend, and give you a chance to chime in there.  My approach was basically the same as I used for #67 to do #81, swapping min for max, but moving it on to #83 eludes me at the moment.  </p>
<p>So thanks, and stay tuned!</p>
<p>&#8230;mrt (who was just waiting for fzz to write a sieve for him <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39908</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Wed, 17 Jun 2009 15:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39908</guid>
		<description>&lt;p&gt;Hi Michael,&lt;br&gt;
I too have become addicted to Project Euler, having first learned about it on this site.  I&#039;ve learned an awful lot about VBA just by doing those problems.  That said, I agree with fzz that the Sieve of Eratasthones is generally the best way to find prime numbers, especially when the upper bound is under a few million.  &lt;/p&gt;
&lt;p&gt;As for Problem 83, I&#039;d be happy to offer as much or as little help as you like.  A couple of questions: What approach have you taken so far?  Did you solve 81 and 82?  How?  I solved all three problems with basically the same algorithm.&lt;/p&gt;
&lt;p&gt;Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Michael,<br />
I too have become addicted to Project Euler, having first learned about it on this site.  I&#8217;ve learned an awful lot about VBA just by doing those problems.  That said, I agree with fzz that the Sieve of Eratasthones is generally the best way to find prime numbers, especially when the upper bound is under a few million.  </p>
<p>As for Problem 83, I&#8217;d be happy to offer as much or as little help as you like.  A couple of questions: What approach have you taken so far?  Did you solve 81 and 82?  How?  I solved all three problems with basically the same algorithm.</p>
<p>Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39892</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 16 Jun 2009 21:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39892</guid>
		<description>&lt;p&gt;Hi fzz -&lt;/p&gt;
&lt;p&gt;No trouble.  Reading the problem wrong is an occupational hazard for Eulerites (Eulerians?).  More than once I&#039;ve come back to a problem when stuck only to see I was trying to check in the wrong part of the process as the answer.  That differs from the times when I read the question right and just flat have a wrong answer ;-) &lt;/p&gt;
&lt;p&gt;And stuck right now is my usual position.  Anybody done #83 please speak up! Being able to go backwards puts me in a infinite loop of minimum cells.  I&#039;ve got a conceptual gap.  Euler said it&#039;s harder, and I attest that it is.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi fzz -</p>
<p>No trouble.  Reading the problem wrong is an occupational hazard for Eulerites (Eulerians?).  More than once I&#8217;ve come back to a problem when stuck only to see I was trying to check in the wrong part of the process as the answer.  That differs from the times when I read the question right and just flat have a wrong answer <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </p>
<p>And stuck right now is my usual position.  Anybody done #83 please speak up! Being able to go backwards puts me in a infinite loop of minimum cells.  I&#8217;ve got a conceptual gap.  Euler said it&#8217;s harder, and I attest that it is.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fzz</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/06/15/euler-problem-123/#comment-39888</link>
		<dc:creator>fzz</dc:creator>
		<pubDate>Tue, 16 Jun 2009 17:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2578#comment-39888</guid>
		<description>&lt;p&gt;Sorry. Your results are correct. I misread the specs, misbelieving that the goal was the maximum remainder for p(n) rather than the remainder specifically when p(n) -/+ 1 are raised to the nth power.&lt;/p&gt;
&lt;p&gt;Still, an approach based on the Sieve of Eratasthones (if you have the RAM) is a lot faster than your approach.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry. Your results are correct. I misread the specs, misbelieving that the goal was the maximum remainder for p(n) rather than the remainder specifically when p(n) -/+ 1 are raised to the nth power.</p>
<p>Still, an approach based on the Sieve of Eratasthones (if you have the RAM) is a lot faster than your approach.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

