<?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: Project Euler Problem 132 Solution</title>
	<atom:link href="http://blog.dreamshire.com/2009/06/15/project-euler-problem-132-solution/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dreamshire.com/2009/06/15/project-euler-problem-132-solution/</link>
	<description>Showing what's behind the curtain</description>
	<lastBuildDate>Sun, 15 Aug 2010 05:51:08 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Mike</title>
		<link>http://blog.dreamshire.com/2009/06/15/project-euler-problem-132-solution/comment-page-1/#comment-364</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 17 Mar 2010 23:36:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dreamshire.com/?p=1652#comment-364</guid>
		<description>Let me explain my variables and why I chose them.  &#039;n&#039; is an odd integer variable that starts from 7.  I only want &#039;n&#039; that is prime so I used the &lt;i&gt;is_prime()&lt;/i&gt; to select them.  
This was just a lazy invention and could be made much more efficient.
&#039;q&#039; is just a constant 10&lt;sup&gt;9&lt;/sup&gt; which is needed in our power mod function (&lt;i&gt;pow()&lt;/i&gt; function with third parameter specified).
Here&#039;s how this solution works.  Any R(n) x 9 + 1 = 10&lt;sup&gt;n&lt;/sup&gt;.  This allows us to use a power mod function, which Python supports natively, to check each prime with a remainder of 1 when 10 is raised to q (10&lt;sup&gt;9&lt;/sup&gt;).  This solution is extensible, however, and can solve problems with similar R(n). 

Also, instead of summing the first 40 primes I used a set so I could learn which primes were used.

Also, it&#039;s never a bother, just have little time to respond quickly sometimes.</description>
		<content:encoded><![CDATA[<p>Let me explain my variables and why I chose them.  &#8216;n&#8217; is an odd integer variable that starts from 7.  I only want &#8216;n&#8217; that is prime so I used the <i>is_prime()</i> to select them.<br />
This was just a lazy invention and could be made much more efficient.<br />
&#8216;q&#8217; is just a constant 10<sup>9</sup> which is needed in our power mod function (<i>pow()</i> function with third parameter specified).<br />
Here&#8217;s how this solution works.  Any R(n) x 9 + 1 = 10<sup>n</sup>.  This allows us to use a power mod function, which Python supports natively, to check each prime with a remainder of 1 when 10 is raised to q (10<sup>9</sup>).  This solution is extensible, however, and can solve problems with similar R(n). </p>
<p>Also, instead of summing the first 40 primes I used a set so I could learn which primes were used.</p>
<p>Also, it&#8217;s never a bother, just have little time to respond quickly sometimes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vijay</title>
		<link>http://blog.dreamshire.com/2009/06/15/project-euler-problem-132-solution/comment-page-1/#comment-362</link>
		<dc:creator>Vijay</dc:creator>
		<pubDate>Thu, 11 Mar 2010 09:17:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dreamshire.com/?p=1652#comment-362</guid>
		<description>Thank you for the reply. I still don&#039;t get the exact idea behind the solution. Can you throw more light on this ?
Sorry to bother you.</description>
		<content:encoded><![CDATA[<p>Thank you for the reply. I still don&#8217;t get the exact idea behind the solution. Can you throw more light on this ?<br />
Sorry to bother you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blog.dreamshire.com/2009/06/15/project-euler-problem-132-solution/comment-page-1/#comment-361</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 11 Mar 2010 01:41:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dreamshire.com/?p=1652#comment-361</guid>
		<description>This is a good question.

Firstly, I should rename the variable &#039;n&#039; to &#039;p&#039; for prime.  That may make things a bit clearer.

Secondly, 7 is the first possible prime that could be considered since 2 and 5 cannot factor a number ending in 1.  Also 3 doesn&#039;t divide 10&lt;sup&gt;9&lt;/sup&gt; (summing the digits of R(10&lt;sup&gt;9&lt;/sup&gt;)).

Lastly, since we start at &#039;n&#039; = 7 we never consider &#039;n&#039; = 3.

Thanks for asking.  Does this answer your question?</description>
		<content:encoded><![CDATA[<p>This is a good question.</p>
<p>Firstly, I should rename the variable &#8216;n&#8217; to &#8216;p&#8217; for prime.  That may make things a bit clearer.</p>
<p>Secondly, 7 is the first possible prime that could be considered since 2 and 5 cannot factor a number ending in 1.  Also 3 doesn&#8217;t divide 10<sup>9</sup> (summing the digits of R(10<sup>9</sup>)).</p>
<p>Lastly, since we start at &#8216;n&#8217; = 7 we never consider &#8216;n&#8217; = 3.</p>
<p>Thanks for asking.  Does this answer your question?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vijay</title>
		<link>http://blog.dreamshire.com/2009/06/15/project-euler-problem-132-solution/comment-page-1/#comment-360</link>
		<dc:creator>Vijay</dc:creator>
		<pubDate>Wed, 10 Mar 2010 12:04:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dreamshire.com/?p=1652#comment-360</guid>
		<description>Hi,
I have a doubt in the solution above.
Why does &#039;n&#039; start with 7 ?
When &#039;n&#039; = 3, pow(10, q, n) == 1 but 3 is not a prime factor of R(10^9). Anyone kindly explain the idea behind this solution. Thank You.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have a doubt in the solution above.<br />
Why does &#8216;n&#8217; start with 7 ?<br />
When &#8216;n&#8217; = 3, pow(10, q, n) == 1 but 3 is not a prime factor of R(10^9). Anyone kindly explain the idea behind this solution. Thank You.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
