<?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: Google Treasure Hunt, Question #4</title>
	<atom:link href="http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/</link>
	<description>When the pupil is ready to learn, a teacher will appear.</description>
	<lastBuildDate>Mon, 30 Jan 2012 20:57:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Christophe Grand</title>
		<link>http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/comment-page-1/#comment-10</link>
		<dc:creator>Christophe Grand</dc:creator>
		<pubDate>Tue, 17 Jun 2008 06:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/#comment-10</guid>
		<description>@david: ah, it fits better in the natural order of all things :-)</description>
		<content:encoded><![CDATA[<p>@david: ah, it fits better in the natural order of all things :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/comment-page-1/#comment-9</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 17 Jun 2008 06:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/#comment-9</guid>
		<description>Ok, saw a canonical solution in Haskell by a more proficient author :) -- in defense of my language du jour, the canonical solution terminated in a couple seconds with no compiler optimizations as far as I know. I&#039;m fairly certain that my bottleneck was my sums function, which potentially recalculated the first n primes to create a sum containing the n+1th prime.</description>
		<content:encoded><![CDATA[<p>Ok, saw a canonical solution in Haskell by a more proficient author :) &#8212; in defense of my language du jour, the canonical solution terminated in a couple seconds with no compiler optimizations as far as I know. I&#8217;m fairly certain that my bottleneck was my sums function, which potentially recalculated the first n primes to create a sum containing the n+1th prime.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: que</title>
		<link>http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/comment-page-1/#comment-8</link>
		<dc:creator>que</dc:creator>
		<pubDate>Wed, 11 Jun 2008 12:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/#comment-8</guid>
		<description>Well, here is result of mine ruby implementation:&lt;br/&gt;Solving...&lt;br/&gt;Found: 9174901. Testing...solved.&lt;br/&gt;Time elapsed: 3.343&lt;br/&gt;:)</description>
		<content:encoded><![CDATA[<p>Well, here is result of mine ruby implementation:<br />Solving&#8230;<br />Found: 9174901. Testing&#8230;solved.<br />Time elapsed: 3.343<br />:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe Grand</title>
		<link>http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/comment-page-1/#comment-7</link>
		<dc:creator>Christophe Grand</dc:creator>
		<pubDate>Wed, 11 Jun 2008 05:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/#comment-7</guid>
		<description>@david: my implementation of primes can be found here: http://clj-me.blogspot.com/2008/06/primes.html&lt;br/&gt;&lt;br/&gt;To be fair, I retimed:&lt;br/&gt;user=&gt; (time (find= (cons primes (map sum-primes [3, 5, 11, 1493]))))&lt;br/&gt;&quot;Elapsed time: 88650.283232 msecs&quot;&lt;br/&gt;9174901&lt;br/&gt;user=&gt;  (time (find= (cons primes (map sum-primes [3, 5, 11, 1493]))))&lt;br/&gt;&quot;Elapsed time: 5894.601122 msecs&quot;&lt;br/&gt;9174901&lt;br/&gt;&lt;br/&gt;I guess that I got 20s by having some primes computed from a prior invocation. So nearly 90s with no primes precomputed and 6s when all required primes are already computed.</description>
		<content:encoded><![CDATA[<p>@david: my implementation of primes can be found here: <a href="http://clj-me.blogspot.com/2008/06/primes.html" rel="nofollow">http://clj-me.blogspot.com/2008/06/primes.html</a></p>
<p>To be fair, I retimed:<br />user=> (time (find= (cons primes (map sum-primes [3, 5, 11, 1493]))))<br />&#8220;Elapsed time: 88650.283232 msecs&#8221;<br />9174901<br />user=>  (time (find= (cons primes (map sum-primes [3, 5, 11, 1493]))))<br />&#8220;Elapsed time: 5894.601122 msecs&#8221;<br />9174901</p>
<p>I guess that I got 20s by having some primes computed from a prior invocation. So nearly 90s with no primes precomputed and 6s when all required primes are already computed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/comment-page-1/#comment-6</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 10 Jun 2008 20:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://clj-me.cgrand.net/2008/06/10/google-treasure-hunt-question-4/#comment-6</guid>
		<description>Very impressive. What&#039;s your implementation of primes? My Haskell implementation, with all compiler optimizations turned on, took about 16 minutes. (I&#039;m a Haskell novice, but still, 20 seconds on JVM vs. 16 minutes for native code says something).&lt;br/&gt;&lt;br/&gt;import Primes&lt;br/&gt;import Data.List hiding (find)&lt;br/&gt;&lt;br/&gt;sums n = map (\m -&gt; sum . take n $ drop m primes) [0..]&lt;br/&gt;&lt;br/&gt;find ss@((x:_):_) =&lt;br/&gt;        if all (== x) (map head ss) then x&lt;br/&gt;        else let ss&#039; = map snd $ sort $ zip (map head ss) ss in&lt;br/&gt;                        find $ tail (head ss&#039;) : tail ss&#039;&lt;br/&gt;&lt;br/&gt;main = print $ find (primes : map sums [3, 5, 11, 1493])</description>
		<content:encoded><![CDATA[<p>Very impressive. What&#8217;s your implementation of primes? My Haskell implementation, with all compiler optimizations turned on, took about 16 minutes. (I&#8217;m a Haskell novice, but still, 20 seconds on JVM vs. 16 minutes for native code says something).</p>
<p>import Primes<br />import Data.List hiding (find)</p>
<p>sums n = map (\m -> sum . take n $ drop m primes) [0..]</p>
<p>find ss@((x:_):_) =<br />        if all (== x) (map head ss) then x<br />        else let ss&#8217; = map snd $ sort $ zip (map head ss) ss in<br />                        find $ tail (head ss&#8217;) : tail ss&#8217;</p>
<p>main = print $ find (primes : map sums [3, 5, 11, 1493])</p>
]]></content:encoded>
	</item>
</channel>
</rss>

