<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Project Euler Problems 1 and 2</title>
	<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/</link>
	<description>Incoherent and disjointed opinionated drivel from somewhere near London</description>
	<pubDate>Wed, 20 Aug 2008 10:27:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Path To Nirvana</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-2830</link>
		<dc:creator>Path To Nirvana</dc:creator>
		<pubDate>Fri, 18 Jul 2008 18:31:20 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-2830</guid>
		<description>&lt;strong&gt;ProjectEuler Problem&#160;1...&lt;/strong&gt;

I have been learning Haskell, since couple of weeks. I am following the online book, Real World Haskell. For fun and learning, I decided to solve some problems from ProjectEuler. My solution for the first problem went through 3 stages, as I learnt more...</description>
		<content:encoded><![CDATA[<p><strong>ProjectEuler Problem&nbsp;1&#8230;</strong></p>
<p>I have been learning Haskell, since couple of weeks. I am following the online book, Real World Haskell. For fun and learning, I decided to solve some problems from ProjectEuler. My solution for the first problem went through 3 stages, as I learnt more&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugh Redelmeier</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-776</link>
		<dc:creator>Hugh Redelmeier</dc:creator>
		<pubDate>Fri, 11 Apr 2008 14:38:04 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-776</guid>
		<description>-jn-:
Functional programming didn't lead you to the fastest solution since you didn't get to the fastest solution.  Yours has a loop (recursion). My bc solution (above) has none.  It also happens to be side-effect free and hence functional.

My version takes a little bit of mathematical reasoning to come up with, or a memory of the tale of Gauss summing the integers 1 to 50 too quickly for his teacher http://www.americanscientist.org/template/AssetDetail/assetid/50686?&#38;print=yes</description>
		<content:encoded><![CDATA[<p>-jn-:<br />
Functional programming didn&#8217;t lead you to the fastest solution since you didn&#8217;t get to the fastest solution.  Yours has a loop (recursion). My bc solution (above) has none.  It also happens to be side-effect free and hence functional.</p>
<p>My version takes a little bit of mathematical reasoning to come up with, or a memory of the tale of Gauss summing the integers 1 to 50 too quickly for his teacher <a href="http://www.americanscientist.org/template/AssetDetail/assetid/50686?&amp;print=yes" rel="nofollow">http://www.americanscientist.org/template/AssetDetail/assetid/50686?&amp;print=yes</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: -jn-</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-768</link>
		<dc:creator>-jn-</dc:creator>
		<pubDate>Thu, 10 Apr 2008 02:24:30 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-768</guid>
		<description>I finished the saga of Project Euler problem one, and found that the functional approach led me to the fastest solution in an unexpected way ( http://joelneely.wordpress.com/2008/04/09/the-burden-of-fp-part-3/ ). Thanks for the encouragement, and for keeping your series going.</description>
		<content:encoded><![CDATA[<p>I finished the saga of Project Euler problem one, and found that the functional approach led me to the fastest solution in an unexpected way ( <a href="http://joelneely.wordpress.com/2008/04/09/the-burden-of-fp-part-3/" rel="nofollow">http://joelneely.wordpress.com/2008/04/09/the-burden-of-fp-part-3/</a> ). Thanks for the encouragement, and for keeping your series going.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The burden of FP &#171; Sliding up the banister</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-736</link>
		<dc:creator>The burden of FP &#171; Sliding up the banister</dc:creator>
		<pubDate>Sun, 06 Apr 2008 16:58:33 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-736</guid>
		<description>[...] not) brings me to Project Euler and the title of this post. I had heard of Project Euler before, butthis post enticed me to visit the site. One look and I was [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] not) brings me to Project Euler and the title of this post. I had heard of Project Euler before, butthis post enticed me to visit the site. One look and I was [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugh Redelmeier</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-625</link>
		<dc:creator>Hugh Redelmeier</dc:creator>
		<pubDate>Mon, 24 Mar 2008 19:03:28 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-625</guid>
		<description>Problem 1 seems to be quite efficiently solved in the standard UNIX bc program.  O(1) (ignoring the fact that bc uses arbitrary precision numbers).
  $ bc
  define s(n) { return n * (n + 1) / 2 }
  define t(n,m) { return s((n - (n % m)) / m) * m }
  t(999,3) + t(999,5) - t(999,15)
  233168
  quit

s(n) is the sum of the integers 1 to n, inclusive.
t(n,m) is the sum of all the integers that are multiples of m between 1 and n, inclusive.
The problem answer is the (sum of multiples of three) + (sum of multiples of five) - (sum of multiples of 15 since they would have been counted twice).

Your C# program would choke if you changed 1000 to a googol.  The BC program says:
23333333333333333333333333333333333333333333333333333
33333333333333333333333333333333333333333333333166666
66666666666666666666666666666666666666666666666666666
66666666666666666666666666666666666666668
I haven't checked if that is correct. but it has about the right number of digits.</description>
		<content:encoded><![CDATA[<p>Problem 1 seems to be quite efficiently solved in the standard UNIX bc program.  O(1) (ignoring the fact that bc uses arbitrary precision numbers).<br />
  $ bc<br />
  define s(n) { return n * (n + 1) / 2 }<br />
  define t(n,m) { return s((n - (n % m)) / m) * m }<br />
  t(999,3) + t(999,5) - t(999,15)<br />
  233168<br />
  quit</p>
<p>s(n) is the sum of the integers 1 to n, inclusive.<br />
t(n,m) is the sum of all the integers that are multiples of m between 1 and n, inclusive.<br />
The problem answer is the (sum of multiples of three) + (sum of multiples of five) - (sum of multiples of 15 since they would have been counted twice).</p>
<p>Your C# program would choke if you changed 1000 to a googol.  The BC program says:<br />
23333333333333333333333333333333333333333333333333333<br />
33333333333333333333333333333333333333333333333166666<br />
66666666666666666666666666666666666666666666666666666<br />
66666666666666666666666666666666666666668<br />
I haven&#8217;t checked if that is correct. but it has about the right number of digits.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PJ6</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-583</link>
		<dc:creator>PJ6</dc:creator>
		<pubDate>Sun, 23 Mar 2008 17:19:15 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-583</guid>
		<description>Actually, someone throw Ackermann at it and see what it does...</description>
		<content:encoded><![CDATA[<p>Actually, someone throw Ackermann at it and see what it does&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PJ6</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-582</link>
		<dc:creator>PJ6</dc:creator>
		<pubDate>Sun, 23 Mar 2008 17:15:17 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-582</guid>
		<description>J: The DotNet Framework's compiler works extremely well. I would expect that the newer structures are supported with optimizations that one could otherwise only achieve writing IL by hand.</description>
		<content:encoded><![CDATA[<p>J: The DotNet Framework&#8217;s compiler works extremely well. I would expect that the newer structures are supported with optimizations that one could otherwise only achieve writing IL by hand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-564</link>
		<dc:creator>J</dc:creator>
		<pubDate>Sun, 23 Mar 2008 10:30:50 +0000</pubDate>
		<guid>http://basildoncoder.com/blog/2008/03/22/project-euler-problems-1-and-2/#comment-564</guid>
		<description>I quote "C# could solve problem 1 very neatly - can it keep up the pace in problem 2? Actually, yes it can, after a fashion."

While efficient writing is one thing, what happens when the code hits the silicon?  Do they compile efficiently?  Does the processor run faster with one snippet over another?

Many get spoiled by GHz machines with GB of RAM, but those of us in the embedded market still worry about code size and execution speed...

J</description>
		<content:encoded><![CDATA[<p>I quote &#8220;C# could solve problem 1 very neatly - can it keep up the pace in problem 2? Actually, yes it can, after a fashion.&#8221;</p>
<p>While efficient writing is one thing, what happens when the code hits the silicon?  Do they compile efficiently?  Does the processor run faster with one snippet over another?</p>
<p>Many get spoiled by GHz machines with GB of RAM, but those of us in the embedded market still worry about code size and execution speed&#8230;</p>
<p>J</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.339 seconds -->
