<?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"
	>
<channel>
	<title>Comments on: SICP section 1.2.6</title>
	<atom:link href="http://eli.thegreenplace.net/2007/07/09/sicp-section-126/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2007/07/09/sicp-section-126/</link>
	<description>Eli Bendersky's personal website</description>
	<pubDate>Thu, 04 Dec 2008 02:57:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: gorilych</title>
		<link>http://eli.thegreenplace.net/2007/07/09/sicp-section-126/#comment-132354</link>
		<dc:creator>gorilych</dc:creator>
		<pubDate>Thu, 25 Sep 2008 06:24:57 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2007/07/09/sicp-section-126/#comment-132354</guid>
		<description>Well, I forgot to say:

Thank you for your great work.

I'm lisp newbie and I'm using your blog to learn Lisp.</description>
		<content:encoded><![CDATA[<p>Well, I forgot to say:</p>
<p>Thank you for your great work.</p>
<p>I&#8217;m lisp newbie and I&#8217;m using your blog to learn Lisp.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gorilych</title>
		<link>http://eli.thegreenplace.net/2007/07/09/sicp-section-126/#comment-132352</link>
		<dc:creator>gorilych</dc:creator>
		<pubDate>Thu, 25 Sep 2008 06:18:55 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2007/07/09/sicp-section-126/#comment-132352</guid>
		<description>On your solution for ex.1.22

You're missing the point. O(sqrt(n)) is the order of growth for (prime? n) not for your function (search-for-primes from to).

Rewrite search-for-primes so it outputs not only prime number, but also time elapsed during its testing of this particular number. F.e. (below s-f-p version takes 2 args - start point and how many primes to find) :

&#62; (search-for-primes 100000000000 3)
100000000003 is prime, testing time = 0.1 sec.
100000000019 is prime, testing time = 0.088 sec.
100000000057 is prime, testing time = 0.087 sec.
Done
&#62; (search-for-primes 1000000000000 3)
1000000000039 is prime, testing time = 0.282 sec.
1000000000061 is prime, testing time = 0.282 sec.
1000000000063 is prime, testing time = 0.283 sec.
Done
&#62; (search-for-primes 10000000000000 3)
10000000000037 is prime, testing time = 0.899 sec.
10000000000051 is prime, testing time = 0.89 sec.
10000000000099 is prime, testing time = 0.891 sec.
Done

Sequence 0.09 - 0.28 - 0.9 fits theory quite good.</description>
		<content:encoded><![CDATA[<p>On your solution for ex.1.22</p>
<p>You&#8217;re missing the point. O(sqrt(n)) is the order of growth for (prime? n) not for your function (search-for-primes from to).</p>
<p>Rewrite search-for-primes so it outputs not only prime number, but also time elapsed during its testing of this particular number. F.e. (below s-f-p version takes 2 args - start point and how many primes to find) :</p>
<p>&gt; (search-for-primes 100000000000 3)<br />
100000000003 is prime, testing time = 0.1 sec.<br />
100000000019 is prime, testing time = 0.088 sec.<br />
100000000057 is prime, testing time = 0.087 sec.<br />
Done<br />
&gt; (search-for-primes 1000000000000 3)<br />
1000000000039 is prime, testing time = 0.282 sec.<br />
1000000000061 is prime, testing time = 0.282 sec.<br />
1000000000063 is prime, testing time = 0.283 sec.<br />
Done<br />
&gt; (search-for-primes 10000000000000 3)<br />
10000000000037 is prime, testing time = 0.899 sec.<br />
10000000000051 is prime, testing time = 0.89 sec.<br />
10000000000099 is prime, testing time = 0.891 sec.<br />
Done</p>
<p>Sequence 0.09 - 0.28 - 0.9 fits theory quite good.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
