<?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 76</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:06:07 +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/08/01/euler-problem-76/#comment-41212</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 23 Sep 2009 19:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-41212</guid>
		<description>&lt;p&gt;Hi Tim -&lt;/p&gt;
&lt;p&gt;Prime is an array of Booleans.  In the above, it keeps getting Re-Dimmed to a larger array.&lt;/p&gt;
&lt;p&gt;Sift() is a functional implementation (it&#039;s above) of the Sieve of Eratosthenes (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes&lt;/a&gt;).  It &lt;i&gt;very quickly&lt;/i&gt; assigns TRUE to the boolean if the index is a prime number.  So you can find if a number is prime by &quot;If Prime(n)&quot; returns true.  To make this work, you have to have set the boundaries above the n you are interested in.&lt;/p&gt;
&lt;p&gt;So my &quot;Sift Sieve:=Prime&quot; is a VBA play on words (&quot;sifting the prime sieve&quot; )to create the proper boolean array.  Works very well.  It can be made faster by being TRUE if a number is NOT PRIME, but I like the logic better this way.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Tim -</p>
<p>Prime is an array of Booleans.  In the above, it keeps getting Re-Dimmed to a larger array.</p>
<p>Sift() is a functional implementation (it&#8217;s above) of the Sieve of Eratosthenes (see <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow">http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes</a>).  It <i>very quickly</i> assigns TRUE to the boolean if the index is a prime number.  So you can find if a number is prime by &#8220;If Prime(n)&#8221; returns true.  To make this work, you have to have set the boundaries above the n you are interested in.</p>
<p>So my &#8220;Sift Sieve:=Prime&#8221; is a VBA play on words (&#8220;sifting the prime sieve&#8221; )to create the proper boolean array.  Works very well.  It can be made faster by being TRUE if a number is NOT PRIME, but I like the logic better this way.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Martin</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-41211</link>
		<dc:creator>Tim Martin</dc:creator>
		<pubDate>Wed, 23 Sep 2009 16:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-41211</guid>
		<description>&lt;p&gt;Hi Michael,&lt;/p&gt;
&lt;p&gt;Can you explain what the line of code in your post on August 05, 2009 at 2:26 pm does?&lt;/p&gt;
&lt;p&gt;It is inside your prime sieve.&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;Sift Sieve:=Prime&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I have not seen/used this before.&lt;/p&gt;
&lt;p&gt;-Tim&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Michael,</p>
<p>Can you explain what the line of code in your post on August 05, 2009 at 2:26 pm does?</p>
<p>It is inside your prime sieve.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">Sift Sieve:=Prime</div>
</div>
<p>I have not seen/used this before.</p>
<p>-Tim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40511</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Fri, 07 Aug 2009 00:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40511</guid>
		<description>&lt;p&gt;Hi Josh -&lt;/p&gt;
&lt;p&gt;I just did 131 exactly that way.  Double ugly.  Then in the forum found a 4-liner solution once the arrays are populated. Some times I have the math insight, but most often not.  For 131 I was sort of half-math ;-)&lt;/p&gt;
&lt;p&gt;Not sure what&#039;s next...I sort of do them in difficulty order picking one that I think understand on page 3 when the problems are sorted in ascending order of difficulty.&lt;/p&gt;
&lt;p&gt;#205 goes up Saturday.  I found an approach that took me from 385 seconds to about 0.6 seconds.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Josh -</p>
<p>I just did 131 exactly that way.  Double ugly.  Then in the forum found a 4-liner solution once the arrays are populated. Some times I have the math insight, but most often not.  For 131 I was sort of half-math <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Not sure what&#8217;s next&#8230;I sort of do them in difficulty order picking one that I think understand on page 3 when the problems are sorted in ascending order of difficulty.</p>
<p>#205 goes up Saturday.  I found an approach that took me from 385 seconds to about 0.6 seconds.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40503</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Thu, 06 Aug 2009 17:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40503</guid>
		<description>&lt;p&gt;Michael,&lt;br&gt;
Glad to help.&lt;/p&gt;
&lt;p&gt;That&#039;s a pretty sweet machine for sure.  &lt;/p&gt;
&lt;p&gt;What problem are you working on next?  This latest collection of partition problems, especially #76, is one of the reasons I love PE.  I can often hack my way to a solution, sometimes in Euler time and sometimes not, and then visit the forums and get blown away by something I&#039;ve never heard of before.  The flip side of this is that many times it seems that if you don&#039;t know the right algorithm / equation, the problem is nearly impossible to solve.  #233 for example seems to fall in this class.  It can be really frustrating.  I think I&#039;ve found the right approach, but it took quite a while to find it and even longer to understand how to use it.  Now, I just need to figure out how to program it...&lt;/p&gt;
&lt;p&gt;-Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael,<br />
Glad to help.</p>
<p>That&#8217;s a pretty sweet machine for sure.  </p>
<p>What problem are you working on next?  This latest collection of partition problems, especially #76, is one of the reasons I love PE.  I can often hack my way to a solution, sometimes in Euler time and sometimes not, and then visit the forums and get blown away by something I&#8217;ve never heard of before.  The flip side of this is that many times it seems that if you don&#8217;t know the right algorithm / equation, the problem is nearly impossible to solve.  #233 for example seems to fall in this class.  It can be really frustrating.  I think I&#8217;ve found the right approach, but it took quite a while to find it and even longer to understand how to use it.  Now, I just need to figure out how to program it&#8230;</p>
<p>-Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40492</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 05 Aug 2009 22:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40492</guid>
		<description>&lt;p&gt;Hi Josh -&lt;/p&gt;
&lt;p&gt;Victory!  0.5625 seconds.  Thank you.&lt;/p&gt;
&lt;p&gt;Per the System Properties/General:  Intel(R) Core(TM)2 Duo CPU E8400 @3.00GHz 1.97GHz, 3.46GB of RAM&lt;/p&gt;
&lt;p&gt;It&#039;s my tech refresh hot rod.  Now on to the next one.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Josh -</p>
<p>Victory!  0.5625 seconds.  Thank you.</p>
<p>Per the System Properties/General:  Intel(R) Core(TM)2 Duo CPU E8400 @3.00GHz 1.97GHz, 3.46GB of RAM</p>
<p>It&#8217;s my tech refresh hot rod.  Now on to the next one.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40491</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Wed, 05 Aug 2009 21:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40491</guid>
		<description>&lt;p&gt;Michael,&lt;br&gt;
Your new code runs in 2.5 seconds for me.  You must have a fast machine indeed!&lt;/p&gt;
&lt;p&gt;Suggestion: in the findsum function argument list, change the line from&lt;br&gt;
ByRef PrimeArr as Variant&lt;br&gt;
to&lt;br&gt;
ByRef PrimeArr() as Long&lt;/p&gt;
&lt;p&gt;Cuts the time to ~0.75 seconds for me.  &lt;/p&gt;
&lt;p&gt;I try not to use globals much, but I make an exception for the primes array.  They get used and passed between procedures so often that it&#039;s easier for me to just let them go everywhere on their own.&lt;/p&gt;
&lt;p&gt;-Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael,<br />
Your new code runs in 2.5 seconds for me.  You must have a fast machine indeed!</p>
<p>Suggestion: in the findsum function argument list, change the line from<br />
ByRef PrimeArr as Variant<br />
to<br />
ByRef PrimeArr() as Long</p>
<p>Cuts the time to ~0.75 seconds for me.  </p>
<p>I try not to use globals much, but I make an exception for the primes array.  They get used and passed between procedures so often that it&#8217;s easier for me to just let them go everywhere on their own.</p>
<p>-Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40489</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 05 Aug 2009 21:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40489</guid>
		<description>&lt;p&gt;Josh -&lt;/p&gt;
&lt;p&gt;Oh. Haven&#039;t got the hang of it yet.  My old code did run in 3.5 seconds.  New arrayed code in 1.5.  Something eludes my grasp here about ref to arrays.  No globals any more.&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;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Euler77()&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; MaxNum &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, T &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Single&lt;/span&gt;, i &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, j &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; Item &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, Key &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;, T1 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Single&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; Prime() &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;, PrimeArr(1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 100) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;T = Timer&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;MaxNum = 1&lt;br&gt;
&#160; &#160;j = 0&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; MaxNum = MaxNum + 1&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; Prime(1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; MaxNum) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; Sift Sieve:=Prime&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Prime(MaxNum) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;j = j + 1&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;PrimeArr(j) = MaxNum&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Until&lt;/span&gt; findsum(MaxNum, 1, PrimeArr, j) &gt; 5000&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;Debug.&lt;span class=&quot;kw1&quot;&gt;Print&lt;/span&gt; MaxNum, Timer - T&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; findsum(money &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, maxcoin &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, &lt;span class=&quot;kw1&quot;&gt;ByRef&lt;/span&gt; PrimeArr &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;, j &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sum &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, i &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;sum = 0&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; maxcoin = j &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; findsum = 1&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = maxcoin &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; j&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; money - PrimeArr(i) = 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; sum = sum + 1&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; money - PrimeArr(i) &gt; 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; sum = sum + findsum(money - PrimeArr(i), i, PrimeArr, j)&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160;findsum = sum&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Same number of trips.  No surprise there.  j is the pointer to the last added prime.  Was the collection count before.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Josh -</p>
<p>Oh. Haven&#8217;t got the hang of it yet.  My old code did run in 3.5 seconds.  New arrayed code in 1.5.  Something eludes my grasp here about ref to arrays.  No globals any more.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> Euler77()<br />
&nbsp; &nbsp;<span class="kw1">Dim</span> MaxNum <span class="kw1">As</span> <span class="kw1">Long</span>, T <span class="kw1">As</span> <span class="kw1">Single</span>, i <span class="kw1">As</span> <span class="kw1">Long</span>, j <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;<span class="kw1">Dim</span> Item <span class="kw1">As</span> <span class="kw1">Long</span>, Key <span class="kw1">As</span> <span class="kw1">String</span>, T1 <span class="kw1">As</span> <span class="kw1">Single</span><br />
&nbsp; &nbsp;<span class="kw1">Dim</span> Prime() <span class="kw1">As</span> <span class="kw1">Boolean</span>, PrimeArr(1 <span class="kw1">To</span> 100) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp;<br />
&nbsp; &nbsp;T = Timer<br />
&nbsp;<br />
&nbsp; &nbsp;MaxNum = 1<br />
&nbsp; &nbsp;j = 0<br />
&nbsp; &nbsp;<span class="kw1">Do</span><br />
&nbsp; &nbsp; &nbsp; MaxNum = MaxNum + 1<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">ReDim</span> Prime(1 <span class="kw1">To</span> MaxNum) <span class="kw1">As</span> <span class="kw1">Boolean</span><br />
&nbsp; &nbsp; &nbsp; Sift Sieve:=Prime<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Prime(MaxNum) <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;j = j + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PrimeArr(j) = MaxNum<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp;<span class="kw1">Loop</span> <span class="kw1">Until</span> findsum(MaxNum, 1, PrimeArr, j) &amp;gt; 5000<br />
&nbsp;<br />
&nbsp; &nbsp;Debug.<span class="kw1">Print</span> MaxNum, Timer &#8211; T<br />
<span class="kw1">End</span> <span class="kw1">Sub</span><br />
<span class="kw1">Function</span> findsum(money <span class="kw1">As</span> <span class="kw1">Long</span>, maxcoin <span class="kw1">As</span> <span class="kw1">Long</span>, <span class="kw1">ByRef</span> PrimeArr <span class="kw1">As</span> <span class="kw1">Variant</span>, j <span class="kw1">As</span> <span class="kw1">Long</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;<span class="kw1">Dim</span> sum <span class="kw1">As</span> <span class="kw1">Long</span>, i <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp;<br />
&nbsp; &nbsp;sum = 0<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span class="kw1">If</span> maxcoin = j <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; findsum = 1<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">Exit</span> <span class="kw1">Function</span><br />
&nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp;<br />
&nbsp; &nbsp;<span class="kw1">For</span> i = maxcoin <span class="kw1">To</span> j<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> money &#8211; PrimeArr(i) = 0 <span class="kw1">Then</span> sum = sum + 1<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> money &#8211; PrimeArr(i) &amp;gt; 0 <span class="kw1">Then</span> sum = sum + findsum(money &#8211; PrimeArr(i), i, PrimeArr, j)<br />
&nbsp; &nbsp;<span class="kw1">Next</span> i<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;findsum = sum<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
<p>Same number of trips.  No surprise there.  j is the pointer to the last added prime.  Was the collection count before.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JoshG</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40487</link>
		<dc:creator>JoshG</dc:creator>
		<pubDate>Wed, 05 Aug 2009 19:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40487</guid>
		<description>&lt;p&gt;Hi Michael,&lt;br&gt;
Your code as posted takes about 6 seconds on my machine.  I think I found the slowdown though - it&#039;s the collection object.  You&#039;re only adding a few numbers to the collection, but by my count you&#039;re extracting a number about 15 million times!  For comparison I decided to get a list of the first few primes, store them in a collection, and then time how long it took to extract the same number 15 million times.  I then stored the numbers as Longs in an array and timed how long it took to extract the same number 15 million times.&lt;br&gt;
Extract from collection: 3.6 seconds&lt;br&gt;
Extract from array:      0.5 seconds&lt;/p&gt;
&lt;p&gt;I modified your code to use an array rather than a collection and consistently got around 1 second.  Hope this helps.&lt;/p&gt;
&lt;p&gt;-Josh&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Michael,<br />
Your code as posted takes about 6 seconds on my machine.  I think I found the slowdown though &#8211; it&#8217;s the collection object.  You&#8217;re only adding a few numbers to the collection, but by my count you&#8217;re extracting a number about 15 million times!  For comparison I decided to get a list of the first few primes, store them in a collection, and then time how long it took to extract the same number 15 million times.  I then stored the numbers as Longs in an array and timed how long it took to extract the same number 15 million times.<br />
Extract from collection: 3.6 seconds<br />
Extract from array:      0.5 seconds</p>
<p>I modified your code to use an array rather than a collection and consistently got around 1 second.  Hope this helps.</p>
<p>-Josh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40486</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 05 Aug 2009 17:56:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40486</guid>
		<description>&lt;p&gt;At the top, it&#039;s&lt;/p&gt;
&lt;p&gt;If PrimeCol.Count != to 0 then&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>At the top, it&#8217;s</p>
<p>If PrimeCol.Count != to 0 then</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/01/euler-problem-76/#comment-40484</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 05 Aug 2009 17:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2755#comment-40484</guid>
		<description>&lt;p&gt;Hi Josh - FWIW&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;&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; PrimeCol &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;New&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Collection&lt;/span&gt;, Num &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Euler77()&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; MaxNum &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, T &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Single&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; Prime() &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;T = Timer&lt;br&gt;
&#160; &#160;Num = 0&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; PrimeCol.Count &#160;0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;PrimeCol.Remove (PrimeCol.Count)&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Until&lt;/span&gt; PrimeCol.Count = 0&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;MaxNum = 1&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; MaxNum = MaxNum + 1&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; Prime(1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; MaxNum) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; Sift Sieve:=Prime&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Prime(MaxNum) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; PrimeCol.Add Item:=MaxNum, Key:=&lt;span class=&quot;kw1&quot;&gt;CStr&lt;/span&gt;(MaxNum)&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Until&lt;/span&gt; findsum(MaxNum, 1) &gt; 5000&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;Debug.&lt;span class=&quot;kw1&quot;&gt;Print&lt;/span&gt; MaxNum, Timer - T, Num&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; findsum(money &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, maxcoin &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sum &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, i &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;Num = Num + 1&lt;br&gt;
&#160; &#160;sum = 0&lt;br&gt;
&#160; &#160;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; maxcoin = PrimeCol.Count &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; findsum = 1&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = maxcoin &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; PrimeCol.Count&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; money - PrimeCol(i) = 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; sum = sum + 1&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; money - PrimeCol(i) &gt; 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; sum = sum + findsum(money - PrimeCol(i), i)&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;br&gt;
&#160; &#160; &#160;&lt;br&gt;
&#160; &#160;findsum = sum&lt;br&gt;
&#160; &lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; Sift(&lt;span class=&quot;kw1&quot;&gt;ByRef&lt;/span&gt; Sieve &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;co1&quot;&gt;&#039;Sets Sieve(N) TRUE if prime&lt;br&gt;
&lt;/span&gt; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; Limit &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, BreakPT &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; N &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, M &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, Count &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160;Limit = &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(Sieve)&lt;br&gt;
&#160; &#160;BreakPT = Int(Sqr(Limit))&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160;Sieve(1) = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160;Sieve(2) = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; N = 3 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; Limit&lt;br&gt;
&#160; &#160; &#160; Sieve(N) = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; N &lt;span class=&quot;kw1&quot;&gt;Mod&lt;/span&gt; 2 = 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; Sieve(N) = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; N&lt;br&gt;
&#160;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; N = 3 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; BreakPT &lt;span class=&quot;kw1&quot;&gt;Step&lt;/span&gt; 2&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Sieve(N) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; M = N * N &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; Limit &lt;span class=&quot;kw1&quot;&gt;Step&lt;/span&gt; 2 * N&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; Sieve(M) = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; M&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; N&lt;br&gt;
&#160;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Josh &#8211; FWIW</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Private</span> PrimeCol <span class="kw1">As</span> <span class="kw1">New</span> <span class="kw1">Collection</span>, Num <span class="kw1">As</span> <span class="kw1">Long</span><br />
<span class="kw1">Sub</span> Euler77()<br />
&nbsp; &nbsp;<span class="kw1">Dim</span> MaxNum <span class="kw1">As</span> <span class="kw1">Long</span>, T <span class="kw1">As</span> <span class="kw1">Single</span><br />
&nbsp; &nbsp;<span class="kw1">Dim</span> Prime() <span class="kw1">As</span> <span class="kw1">Boolean</span><br />
&nbsp;<br />
&nbsp; &nbsp;T = Timer<br />
&nbsp; &nbsp;Num = 0<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span class="kw1">If</span> PrimeCol.Count &nbsp;0 <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">Do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PrimeCol.Remove (PrimeCol.Count)<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">Loop</span> <span class="kw1">Until</span> PrimeCol.Count = 0<br />
&nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp;<br />
&nbsp; &nbsp;MaxNum = 1<br />
&nbsp; &nbsp;<span class="kw1">Do</span><br />
&nbsp; &nbsp; &nbsp; MaxNum = MaxNum + 1<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">ReDim</span> Prime(1 <span class="kw1">To</span> MaxNum) <span class="kw1">As</span> <span class="kw1">Boolean</span><br />
&nbsp; &nbsp; &nbsp; Sift Sieve:=Prime<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Prime(MaxNum) <span class="kw1">Then</span> PrimeCol.Add Item:=MaxNum, Key:=<span class="kw1">CStr</span>(MaxNum)<br />
&nbsp; &nbsp;<span class="kw1">Loop</span> <span class="kw1">Until</span> findsum(MaxNum, 1) &amp;gt; 5000<br />
&nbsp;<br />
&nbsp; &nbsp;Debug.<span class="kw1">Print</span> MaxNum, Timer &#8211; T, Num<br />
<span class="kw1">End</span> <span class="kw1">Sub</span><br />
<span class="kw1">Function</span> findsum(money <span class="kw1">As</span> <span class="kw1">Long</span>, maxcoin <span class="kw1">As</span> <span class="kw1">Long</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;<span class="kw1">Dim</span> sum <span class="kw1">As</span> <span class="kw1">Long</span>, i <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;Num = Num + 1<br />
&nbsp; &nbsp;sum = 0<br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="kw1">If</span> maxcoin = PrimeCol.Count <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; findsum = 1<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">Exit</span> <span class="kw1">Function</span><br />
&nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; <br />
&nbsp; &nbsp;<span class="kw1">For</span> i = maxcoin <span class="kw1">To</span> PrimeCol.Count<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> money &#8211; PrimeCol(i) = 0 <span class="kw1">Then</span> sum = sum + 1<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> money &#8211; PrimeCol(i) &amp;gt; 0 <span class="kw1">Then</span> sum = sum + findsum(money &#8211; PrimeCol(i), i)<br />
&nbsp; &nbsp;<span class="kw1">Next</span> i<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp;findsum = sum<br />
&nbsp; <br />
<span class="kw1">End</span> <span class="kw1">Function</span><br />
<span class="kw1">Function</span> Sift(<span class="kw1">ByRef</span> Sieve <span class="kw1">As</span> <span class="kw1">Variant</span>) <span class="kw1">As</span> <span class="kw1">Variant</span><br />
<span class="co1">&#8216;Sets Sieve(N) TRUE if prime<br />
</span> &nbsp; <span class="kw1">Dim</span> Limit <span class="kw1">As</span> <span class="kw1">Long</span>, BreakPT <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;<span class="kw1">Dim</span> N <span class="kw1">As</span> <span class="kw1">Long</span>, M <span class="kw1">As</span> <span class="kw1">Long</span>, Count <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;Limit = <span class="kw1">UBound</span>(Sieve)<br />
&nbsp; &nbsp;BreakPT = Int(Sqr(Limit))<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;Sieve(1) = <span class="kw1">False</span><br />
&nbsp; &nbsp;Sieve(2) = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="kw1">For</span> N = 3 <span class="kw1">To</span> Limit<br />
&nbsp; &nbsp; &nbsp; Sieve(N) = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> N <span class="kw1">Mod</span> 2 = 0 <span class="kw1">Then</span> Sieve(N) = <span class="kw1">False</span><br />
&nbsp; &nbsp;<span class="kw1">Next</span> N<br />
&nbsp;<br />
&nbsp; &nbsp;<span class="kw1">For</span> N = 3 <span class="kw1">To</span> BreakPT <span class="kw1">Step</span> 2<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Sieve(N) <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">For</span> M = N * N <span class="kw1">To</span> Limit <span class="kw1">Step</span> 2 * N<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sieve(M) = <span class="kw1">False</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">Next</span> M<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp;<span class="kw1">Next</span> N<br />
&nbsp;<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
</channel>
</rss>

