<?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 188</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/</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/11/07/euler-problem-188/#comment-44875</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Fri, 26 Mar 2010 17:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44875</guid>
		<description>&lt;p&gt;Hi Christian -&lt;/p&gt;
&lt;p&gt;I&#039;m an engineer (for 3 more months) and hobbyist programmer solving math problems, not a mathematician solving programming ones ;-) so I can&#039;t really venture a creditable mathematical opinion.  There are those who hang around DDoE who can (i.e fzz), I&#039;m just not one of them.  When you have the right answer, you can check into the Euler problem and read the insights of other solvers, some of whom are math-types.  All that said, my knee quivers that if the general case is bad, the understanding is bad.&lt;/p&gt;
&lt;p&gt;In the case of Euler #188, the loop can be too large or too small by a significant number relative to 1855, and still give the right answer.  And while Euler is fond of problems that support a millisec-quick answer, I think in this case it&#039;s happenstance.  I lucked up with a bad algorithm giving a good result. &lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Christian -</p>
<p>I&#8217;m an engineer (for 3 more months) and hobbyist programmer solving math problems, not a mathematician solving programming ones <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  so I can&#8217;t really venture a creditable mathematical opinion.  There are those who hang around DDoE who can (i.e fzz), I&#8217;m just not one of them.  When you have the right answer, you can check into the Euler problem and read the insights of other solvers, some of whom are math-types.  All that said, my knee quivers that if the general case is bad, the understanding is bad.</p>
<p>In the case of Euler #188, the loop can be too large or too small by a significant number relative to 1855, and still give the right answer.  And while Euler is fond of problems that support a millisec-quick answer, I think in this case it&#8217;s happenstance.  I lucked up with a bad algorithm giving a good result. </p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44846</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Thu, 25 Mar 2010 18:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44846</guid>
		<description>&lt;p&gt;I&#039;ve spent some time thinking about the reason for the correct behaviour of the code. I&#039;m not sure if it&#039;s a 100% correct, so I&#039;d be glad to hear your opinion:&lt;br&gt;
If a and n are coprime there is an integer e called the order of a modulo n with the property that x=y mod e implies a^x=a^y mod n. In case a=1777 and n=10^8, I think the order of a mod n is 2^4*5^7 or maybe 2^5*5^7. In any case it is a divisor of 10^8.&lt;br&gt;
In the general situation, this must not necessarily hold (e.g. consider n=5 and a=2)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve spent some time thinking about the reason for the correct behaviour of the code. I&#8217;m not sure if it&#8217;s a 100% correct, so I&#8217;d be glad to hear your opinion:<br />
If a and n are coprime there is an integer e called the order of a modulo n with the property that x=y mod e implies a^x=a^y mod n. In case a=1777 and n=10^8, I think the order of a mod n is 2^4*5^7 or maybe 2^5*5^7. In any case it is a divisor of 10^8.<br />
In the general situation, this must not necessarily hold (e.g. consider n=5 and a=2)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44806</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 24 Mar 2010 14:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44806</guid>
		<description>&lt;p&gt;The reason the original code provided the right answer is that the loop settled upon it in an amazingly few number of runs.  I found this by dumping the answers into a spreadsheet.  &lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The reason the original code provided the right answer is that the loop settled upon it in an amazingly few number of runs.  I found this by dumping the answers into a spreadsheet.  </p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44788</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 23 Mar 2010 19:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44788</guid>
		<description>&lt;p&gt;Hi Christian -&lt;/p&gt;
&lt;p&gt;There is a logic bug in the above code when m &lt; b, and since nothing depends on &lt;i&gt;i&lt;/i&gt;, there is no need to count backwards.  I was influenced wrongly by having to go right-to-left. Thanks, I&#039;d guess ;-) for making me relook at that code.  I never considered that case.&lt;/p&gt;
&lt;p&gt;For Euler&#039;s case, this works:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;a = 1777&lt;br&gt;
Answer = a&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = 1 &lt;span class=&quot;kw1&quot;&gt;to&lt;/span&gt; 1855-1&lt;br&gt;
&#160; &#160;Answer = Pow(a, Answer, 10 ^ 8)&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;For your case:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;a = 12&lt;br&gt;
Answer = a&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = 1 &lt;span class=&quot;kw1&quot;&gt;to&lt;/span&gt; 2-1&lt;br&gt;
&#160; &#160;Answer = Pow(a,answer,10)&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I can&#039;t satisfy myself with an articulation of the logic bug, so I&#039;d invite your comments.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Christian -</p>
<p>There is a logic bug in the above code when m &lt; b, and since nothing depends on <i>i</i>, there is no need to count backwards.  I was influenced wrongly by having to go right-to-left. Thanks, I&#8217;d guess <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  for making me relook at that code.  I never considered that case.</p>
<p>For Euler&#8217;s case, this works:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">a = 1777<br />
Answer = a<br />
<span class="kw1">For</span> i = 1 <span class="kw1">to</span> 1855-1<br />
&nbsp; &nbsp;Answer = Pow(a, Answer, 10 ^ <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> <br />
<span class="kw1">Next</span> i</div>
</div>
<p>For your case:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">a = 12<br />
Answer = a<br />
<span class="kw1">For</span> i = 1 <span class="kw1">to</span> 2-1<br />
&nbsp; &nbsp;Answer = Pow(a,answer,10)<br />
<span class="kw1">Next</span> i</div>
</div>
<p>I can&#8217;t satisfy myself with an articulation of the logic bug, so I&#8217;d invite your comments.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44774</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 22 Mar 2010 22:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44774</guid>
		<description>&lt;p&gt;Christian -&lt;/p&gt;
&lt;p&gt;My apology, I saw that right after I posted.  There&#039;s something screwy using mod 10.  If I use mod 100, it seems right. &lt;/p&gt;
&lt;p&gt;I&#039;ll think about it and post back.  On the positive side, that code does check in the right answer ;-)&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Christian -</p>
<p>My apology, I saw that right after I posted.  There&#8217;s something screwy using mod 10.  If I use mod 100, it seems right. </p>
<p>I&#8217;ll think about it and post back.  On the positive side, that code does check in the right answer <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: Christian</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44773</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Mon, 22 Mar 2010 22:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44773</guid>
		<description>&lt;p&gt;My point is that 12^12 is 12^^2&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>My point is that 12^12 is 12^^2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44772</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 22 Mar 2010 21:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44772</guid>
		<description>&lt;p&gt;Christian -&lt;/p&gt;
&lt;p&gt;It&#039;s &lt;i&gt;not&lt;/i&gt; 12^12.  It&#039;s hyper-exponentiation.  It&#039;s 12^^12, or in this case it&#039;s not 1777^1885, it&#039;s 1777^^1885.&lt;/p&gt;
&lt;p&gt;See the Wiki article referenced above.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Christian -</p>
<p>It&#8217;s <i>not</i> 12^12.  It&#8217;s hyper-exponentiation.  It&#8217;s 12^^12, or in this case it&#8217;s not 1777^1885, it&#8217;s 1777^^1885.</p>
<p>See the Wiki article referenced above.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44771</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Mon, 22 Mar 2010 21:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44771</guid>
		<description>&lt;p&gt;Let me explain, what irritated me. Have a look at the code&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;Answer=1&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = 2 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 1 &lt;span class=&quot;kw1&quot;&gt;Step&lt;/span&gt; -1&lt;br&gt;
Answer = Pow(12, Answer, 10 )&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;After the first iteration, we have Answer=Pow(12, 1, 10 )=2, and so also after the second iteration, we have Answer=Pow(12, 2, 10 )=4.&lt;/p&gt;
&lt;p&gt;On the other hand we have MOD(12^12,10)=6.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Let me explain, what irritated me. Have a look at the code</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">Answer=1<br />
<span class="kw1">For</span> i = 2 <span class="kw1">To</span> 1 <span class="kw1">Step</span> -1<br />
Answer = Pow(12, Answer, 10 )<br />
<span class="kw1">Next</span> i</div>
</div>
<p>After the first iteration, we have Answer=Pow(12, 1, 10 )=2, and so also after the second iteration, we have Answer=Pow(12, 2, 10 )=4.</p>
<p>On the other hand we have MOD(12^12,10)=6.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44766</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 22 Mar 2010 15:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44766</guid>
		<description>&lt;p&gt;Christian -&lt;/p&gt;
&lt;p&gt;In spreadsheet terms, it uses MOD(a*b,n) = MOD(MOD(a,n)*MOD(b,n),n) which is valid.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Christian -</p>
<p>In spreadsheet terms, it uses MOD(a*b,n) = MOD(MOD(a,n)*MOD(b,n),n) which is valid.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/11/07/euler-problem-188/#comment-44647</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Wed, 17 Mar 2010 18:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3189#comment-44647</guid>
		<description>&lt;p&gt;I&#039;m not sure, if modular theory is used correctly in this example... When writing &lt;/p&gt;
&lt;p&gt;For i = 1855 To 1 Step -1&lt;br&gt;
      Answer = Pow(a, Answer, 10 ^ 8)&lt;br&gt;
Next i&lt;/p&gt;
&lt;p&gt;you seem to use the relation a^b = a^(b mod n) mod n; but this relation is false in general. Please correct me, if I&#039;m wrong...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure, if modular theory is used correctly in this example&#8230; When writing </p>
<p>For i = 1855 To 1 Step -1<br />
      Answer = Pow(a, Answer, 10 ^ <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> <br />
Next i</p>
<p>you seem to use the relation a^b = a^(b mod n) mod n; but this relation is false in general. Please correct me, if I&#8217;m wrong&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

