<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ragged Clown &#187; maths</title>
	<atom:link href="http://www.raggedclown.com/tag/maths/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.raggedclown.com</link>
	<description>It&#039;s just a shadow you&#039;re seeing that he&#039;s chasing...</description>
	<lastBuildDate>Sat, 04 Feb 2012 22:40:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Who cares about this stuff?</title>
		<link>http://www.raggedclown.com/2011/03/09/who-cares-about-this-stuff/</link>
		<comments>http://www.raggedclown.com/2011/03/09/who-cares-about-this-stuff/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 06:12:45 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Categories Suck]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[philosophy]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=2524</guid>
		<description><![CDATA[The Times has a great series of essays by Errol Morris on Thomas Kuhn&#8217;s The Structure of Scientific Revolutions. According to the author, Structure is a post-modern work which makes the relativist claim that people in one paradigm (or culture &#8230; <a href="http://www.raggedclown.com/2011/03/09/who-cares-about-this-stuff/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://opinionator.blogs.nytimes.com/tag/incommensurability/">The Times has a great series of essays by Errol Morris</a> on Thomas Kuhn&#8217;s <a href="http://opinionator.blogs.nytimes.com/2011/03/08/the-ashtray-hippasus-of-metapontum-part-3/">The Structure of Scientific Revolutions.</a></p>
<p>According to the author, <em>Structure</em> is a post-modern work which makes the relativist claim that people in one paradigm (or culture or era) are unable to fairly judge the ideas of another paradigm because the two are paradigms are incommensurable.</p>
<p>The series takes us on a breathtaking tour of the meaning of the word incommensurable through three thousand years of the history of mathematics taking in Pythagoras, the legend of the execution of Hippasus for showing that the square root of two is irrational, Socrates &#038; Plato and the moment that Thomas Kuhn threw an ashtray at the author&#8217;s head before throwing him out of Princeton.</p>
<p>Before reading today&#8217;s article (article 3 of 5), I had taken seriously Kuhn&#8217;s claim that each so-called paradigm shift creates an unbridgable divide from the previous paradigm that scientists are unable to cross.  Kuhn &#8211; like the creators of The legend of Hippasus&#8217;s murder &#8211; created the legend of incommensurability to imply a dramatic resolution to a crisis that never existed. He created a legend which &#8211; like all legends, we learn &#8211; is more memorable than fact.</p>
<p>At the end of today&#8217;s article I was left wondering: how many people are actually interested in this stuff?&#8230;</p>
<p>Who cares about Theories of Naming and incommensurability and proofs of irrationality and philosophy and maths and greek history.</p>
<p>&#8230;and where can I meet them?</p>
<p>Part 4 was published just now. I have reading to do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2011/03/09/who-cares-about-this-stuff/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Where Your Friends Are</title>
		<link>http://www.raggedclown.com/2010/02/13/where-your-friends-are/</link>
		<comments>http://www.raggedclown.com/2010/02/13/where-your-friends-are/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 01:46:12 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=2057</guid>
		<description><![CDATA[Marvellous visualization of where friends tend to cluster in Facebook. Apparently everyone in Dixie knows someone in Atlanta and all the Mormons are friends with each other. My latest visualization shows the information by location, with connections drawn between places &#8230; <a href="http://www.raggedclown.com/2010/02/13/where-your-friends-are/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a title="PeteSearch" href="http://petewarden.typepad.com/searchbrowser/2010/02/how-to-split-up-the-us.html"><img class="size-full wp-image-2056  aligncenter" title="facebook" src="http://www.raggedclown.com/blog/wp-content/uploads/2010/02/facebook.png" alt="facebook" width="800" height="402" /></a></p>
<p style="text-align: left;"><a href="http://petewarden.typepad.com/searchbrowser/2010/02/how-to-split-up-the-us.html">Marvellous visualization</a> of where friends tend to cluster in Facebook. Apparently everyone in Dixie knows someone in Atlanta and all the Mormons are friends with each other.</p>
<blockquote>
<p style="text-align: left;">My <a href="http://fanpageanalytics.com/countryprofiles.html">latest visualization</a> shows the information by location, with connections drawn between places that share friends. For example, a lot of people in LA have friends in San Francisco, so there&#8217;s a line between them.</p>
<p>Looking at the network of US cities, it&#8217;s been remarkable to see how groups of them form clusters, with strong connections locally but few contacts outside the cluster. For example Columbus, OH and Charleston WV are nearby as the crow flies, but share few connections, with Columbus clearly part of the North, and Charleston tied to the South:</p></blockquote>
<p>Take a look at his <a title="Facebook Analytics" href="http://fanpageanalytics.com/countryprofiles.html">country-level visualization</a> too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2010/02/13/where-your-friends-are/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integration is just a better multiplication</title>
		<link>http://www.raggedclown.com/2009/07/16/integration-is-just-a-better-multiplication/</link>
		<comments>http://www.raggedclown.com/2009/07/16/integration-is-just-a-better-multiplication/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 07:03:09 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=1604</guid>
		<description><![CDATA[Regular readers know that I am a big fan of Better Explained in which Kalid makes mathematical ideas accessible. Today&#8217;s installment: Integration is just multiplication when one of the operands is changing. Most people grok integration as area under a &#8230; <a href="http://www.raggedclown.com/2009/07/16/integration-is-just-a-better-multiplication/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Regular readers know that I am a big fan of <em>Better Explained</em> in which Kalid makes mathematical ideas accessible<em>.</em></p>
<p><a title="Better Explained" href="http://betterexplained.com/articles/a-calculus-analogy-integrals-as-multiplication/">Today&#8217;s installment</a>:</p>
<blockquote><p>Integration is just multiplication when one of the operands is changing.</p></blockquote>
<p>Most people grok integration as <em>area under a curve</em> but, as Kalid explains, <em>area</em> is just one convenient way of visualizing multiplication&#8230;but we don&#8217;t need to visualize multiplication as multiplication is already pretty straightforward &#8211; in the simplest case, it&#8217;s just repeated addition.</p>
<p>Many ideas in maths start out simple like that and then gradually generalize to a more complex idea. In Kalid&#8217;s words:</p>
<blockquote><p>Our understanding of multiplication changed over time:</p>
<ul>
<li>With integers (3 Ã— 4), multiplication is <em>repeated addition</em></li>
<li>With real numbers (3.12 x sqrt(2)), multiplication is <em>scaling</em></li>
<li>With negative numbers (-2.3 * 4.3), multiplication is <em>flipping</em> and scaling</li>
<li>With <a href="http://betterexplained.com/articles/a-visual-intuitive-guide-to-imaginary-numbers/">complex numbers</a> (3 * 3i), multiplication is <em>rotating</em> and scaling</li>
</ul>
<p>Weâ€™re evolving towards a general notion of â€œapplyingâ€ one number to another, and the properties we apply (repeated counting, scaling, flipping or rotating) can vary. Integration is another step along this path.</p></blockquote>
<p>In other words,</p>
<blockquote><p>Integration is just a better multiplication</p></blockquote>
<p>or, conversely,</p>
<blockquote><p>Multiplication is a special case of integration when the values are static.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2009/07/16/integration-is-just-a-better-multiplication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ever expanding circles</title>
		<link>http://www.raggedclown.com/2009/03/14/ever-expanding-circles/</link>
		<comments>http://www.raggedclown.com/2009/03/14/ever-expanding-circles/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 19:08:12 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[constitution]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[politics]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=1298</guid>
		<description><![CDATA[Whereas the constitution sets clear boundaries on the authority of the Federal government. Whereas the federal government has no business defining basic mathematical constants. Resolved, that theories, definitions and celebrations of Î  should be left to the various States.]]></description>
			<content:encoded><![CDATA[<p>Whereas the constitution sets clear boundaries on the authority of the Federal government.</p>
<p>Whereas the federal government has no business defining basic mathematical constants.</p>
<p>Resolved, that <a title="The Traffic Light" href="http://thetrafficlight.blogspot.com/2009/03/happy-pi-day.html">theories, definitions and celebrations of Î </a> should be left to the various States.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2009/03/14/ever-expanding-circles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is it a cat?</title>
		<link>http://www.raggedclown.com/2009/01/08/is-it-a-cat/</link>
		<comments>http://www.raggedclown.com/2009/01/08/is-it-a-cat/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 04:51:06 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=1077</guid>
		<description><![CDATA[Last time I visited Better Explanations, I got stuck there for hours. I resisted this time once I realized I was reading all the same articles for a second time. Today&#8217;s bait showed up in my RSS feed. Suppose we &#8230; <a href="http://www.raggedclown.com/2009/01/08/is-it-a-cat/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last time I visited <a title="Better Explanations" href="http://betterexplained.com/articles/developing-your-intuition-for-math/"><em>Better Explanations</em></a>, I got stuck there for hours. I resisted this time once I realized I was reading all the same articles for a second time.</p>
<p>Today&#8217;s bait showed up in my RSS feed.</p>
<blockquote><p>Suppose we want to define a â€œcatâ€:</p>
<ul>
<li><strong>Caveman definition:</strong> A furry animal with claws, teeth, a tail, 4 legs, that purrs when happy and hisses when angryâ€¦</li>
<li><strong>Evolutionary definition:</strong> Mammalian descendants of a certain species (<em>F. catus</em>), sharing certain characteristicsâ€¦</li>
<li><strong>Modern definition:</strong> You call those <em>definitions</em>? Cats are animals sharing the following <span class="caps">DNA</span>: <span class="caps">ACATACATACATACATâ€¦</span></li>
</ul>
<p>The modern definition is precise, sure. But is it the <em>best</em>? Is it what youâ€™d teach a child learning the word? Does it give better insight into the â€œcatnessâ€ of the animal? Not really. The modern definition is useful, but <em>after</em> getting an understanding of what a cat is. It shouldnâ€™t be our starting point.</p></blockquote>
<p>He goes on to explain that, when we teach biology to little kids we start with the simple definition and only gradually work our way up to the modern definition. But when we teach maths, we leap straight in to the modern definition and start teaching them the formula &#8211; so they never really understand the basic concepts behind the formula.</p>
<p>He illustrates his point by walking through what it means to be a circleÂ  and what <strong>e</strong> is all about.</p>
<p>Cool stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2009/01/08/is-it-a-cat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pick me Kate! Pick me!</title>
		<link>http://www.raggedclown.com/2008/08/29/pick-me-kate-pick-me/</link>
		<comments>http://www.raggedclown.com/2008/08/29/pick-me-kate-pick-me/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 21:09:30 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[favourite]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=804</guid>
		<description><![CDATA[Since I have access to all the songs in the world I told Rhapsody to just play me some songs that you think I might like. Rhapsody thought I might like to listen to some Kate Bush which was nice &#8230; <a href="http://www.raggedclown.com/2008/08/29/pick-me-kate-pick-me/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since I have access to all the songs in the world I told Rhapsody to just <em>play me some songs that you think I might like</em>.</p>
<p>Rhapsody thought I might like to listen to some Kate Bush which was nice because I haven&#8217;t listened to Kate Bush since I was about thirteen with hormones and she was about 19 and hot and she lived in the same town as me &#8211; Bexleyheath.</p>
<p><a href="http://www.raggedclown.com/blog/wp-content/uploads/2008/08/kate_bush_10.jpg"><img class="alignleft size-full wp-image-805" title="kate bush" src="http://www.raggedclown.com/blog/wp-content/uploads/2008/08/kate_bush_10.jpg" alt="" width="366" height="500" /></a></p>
<p>I listened to a few familiar tracks &#8211; weird as ever &#8211; and then suddenly our Kate seemed to be singing <em>&#8220;three point one four one five nine&#8230;&#8221;</em>. That&#8217;s odd I thought and glanced at the title.</p>
<p>Sure enough, the song was calledÂ Ï€.</p>
<p>&#8220;I wonder if there is a story behind the song?&#8221; I wondered. And googled.</p>
<p>The song is fairly recent and is a tribute to a man who is infatuated with everyone&#8217;s favourite transcendental number.</p>
<p>It starts&#8230;</p>
<blockquote><p>&#8220;Sweet and gentle and sensitive man<br />
With an obsessive nature and deep fascination for numbers<br />
And a complete infatuation with the calculation of PI</p></blockquote>
<p>&#8230;and then continues with Kate singing the first 150 digits of pi&#8230;but she gets it wrong! She skips a few around 137!</p>
<p>Clearly Kate is much too smart to make a mistake like that and there is bound to be a fascinating explanation&#8230;and&#8230;the interwebs are full of them.</p>
<p>Some of my favourites:</p>
<blockquote><p>the best Craftsmen always make one deliberate mistake in anything they create so that the Gods don&#8217;t punish them for their arrowgance.</p>
<p>The supposed mistakes in pi are all deliberate, and she has actually used them (and lots of other tricks) to embed a secret message in the song. It is our job to decode what that message is.</p>
<p>If that&#8217;s what Kate says pi is, then thats good enough for me. I&#8217;m hacking my calculator and patching my maths libraries.</p></blockquote>
<p>And my favourite theory of all:</p>
<blockquote><p>Kate Bush has been looking all her life for a man who is so geeky that he would notice an error in the Pi song. She&#8217;ll be reading your blog and fantasising about you now, you lucky bugger,</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2008/08/29/pick-me-kate-pick-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Radians?</title>
		<link>http://www.raggedclown.com/2008/07/09/why-radians/</link>
		<comments>http://www.raggedclown.com/2008/07/09/why-radians/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 03:58:18 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=738</guid>
		<description><![CDATA[Ever wondered why there are 360 degrees? Constellations make a circle throughout the year â€” ever see the Big Dipper upside down sometimes? (Never fear, itâ€™ll be rightside-up in 6 months). Hereâ€™s a theory about how degrees came to pass: &#8230; <a href="http://www.raggedclown.com/2008/07/09/why-radians/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever wondered why there are 360 degrees?</p>
<blockquote><p>Constellations <a onclick="javascript:urchinTracker ('/outbound/www.astro.uiuc.edu');" href="http://www.astro.uiuc.edu/%7Ekaler/celsph.html">make a circle</a> throughout the year â€” ever see the Big Dipper upside down sometimes? (Never fear, itâ€™ll be rightside-up in 6 months). Hereâ€™s <a onclick="javascript:urchinTracker ('/outbound/en.wikipedia.org');" href="http://en.wikipedia.org/wiki/Degree_%28angle%29#History">a theory</a> about how degrees came to pass:</p>
<ul>
<li>Humans noticed that constellations moved in a full circle every year</li>
<li>Every day, they moved a tiny bit (â€ a degreeâ€)</li>
<li>Since a year has about 360 days, a circle had 360 degrees</li>
</ul>
<p>But, butâ€¦ why not <em>365 degrees</em> in a circle?</p>
<p>Cut â€˜em some slack: they had <em>sundials</em> and didnâ€™t know a year should have a convenient 365.242199 degrees like you do.</p>
<p>360 is close enough for government work. It fits nicely into the Babylonian base-60 number system, and divides well (by 2, 3, 4, 6, 10, 12, 15, 30, 45, 90â€¦ you get the idea).</p></blockquote>
<p>According to <a title="Better Explained" href="http://betterexplained.com/articles/intuitive-guide-to-angles-degrees-and-radians/">Better Explained,</a> degrees are subjective but radians are objective.</p>
<blockquote><p>A degree is the amount I, an observer, need to tilt my head to see you, the mover. Itâ€™s a tad self-centered, donâ€™t you think?</p>
<p>&#8230;</p>
<p>Much of physics (and life!) involves leaving your reference frame and seeing things from anotherâ€™s viewpoint. Instead of wondering how far we tilted our heads, <strong>consider how far the other person moved</strong>.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2008/07/09/why-radians/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Problem 12</title>
		<link>http://www.raggedclown.com/2008/06/22/problem-12/</link>
		<comments>http://www.raggedclown.com/2008/06/22/problem-12/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 00:59:40 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=730</guid>
		<description><![CDATA[To save you going all the way to Project Euler to read it, I have copied problem 12 here for your puzzle solving convenience&#8230; The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle &#8230; <a href="http://www.raggedclown.com/2008/06/22/problem-12/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To save you going all the way to <a title="Project Euler" href="http://projecteuler.net/index.php?section=problems&amp;id=12">Project Euler to read it, I have copied problem 12</a> here for your puzzle solving convenience&#8230;</p>
<blockquote><p>The sequence of triangle numbers is generated by adding the natural numbers. So the 7<sup>th</sup> triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.</p>
<p>The first ten terms would be:</p>
<p style="text-align: center;">1, 3, 6, 10, 15, 21, 28, 36, 45, 55, &#8230;</p>
<p>Let us list the factors of the first seven triangle numbers:</p>
<p><strong> 1</strong>: 1<br />
<strong> 3</strong>: 1,3<br />
<strong> 6</strong>: 1,2,3,6<br />
<strong>10</strong>: 1,2,5,10<br />
<strong>15</strong>: 1,3,5,15<br />
<strong>21</strong>: 1,3,7,21<br />
<strong>28</strong>: 1,2,4,7,14,28</p>
<p>We can see that 28 is the first triangle number to have over five divisors.</p>
<p>What is the value of the first triangle number to have over five hundred divisors?</p></blockquote>
<p>In case you were wondering, the answer to problem 10 is</p>
<pre><code>
primes = Primes.new
puts primes.find_primes_less_than(2000000).inject{|s,n| s+n}

</code></pre>
<p>How come <em>inject</em> and <em>collect</em> haven&#8217;t caught on in other languages? They are awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2008/06/22/problem-12/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Forgetful me</title>
		<link>http://www.raggedclown.com/2008/06/21/forgetful-me/</link>
		<comments>http://www.raggedclown.com/2008/06/21/forgetful-me/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 00:29:31 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=725</guid>
		<description><![CDATA[According to Kurzweil, the singularity (the moment when we will start to invent things instantaneously) will occur in 2045. According to me the singularity (the moment when I forget things fast than I can learn things) occurs in 2009. Every &#8230; <a href="http://www.raggedclown.com/2008/06/21/forgetful-me/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>According to Kurzweil, <a title="Wikipedia" href="http://en.wikipedia.org/wiki/Technological_singularity">the singularity</a> (the moment when we will start to invent things instantaneously) will occur in 2045. According to me the singularity (the moment when I forget things fast than I can learn things) occurs in 2009.</p>
<p>Every time I start over with Ruby (or XSLT or &#8230;) I find that I have forgotten the most basic things (like how to construct an object).</p>
<p>Anyway, thanks to <a title="Project Euler" href="http://projecteuler.net/index.php">Project Euler</a> (according to which, I am 4% genius), I had an excuse to go go back and learn Ruby all over again.</p>
<p>Here&#8217;s my prime number generator (which is about a third of the size of my Java version):</p>
<pre><code>
class Primes
  def initialize
    @primes = []
    @next_candidate = 2
  end

  def prime? number
    root = Math.sqrt number
    find_primes_less_than root

    @primes.each do |prime|
      return true if prime &gt; root
      return false if number % prime == 0
    end
  end

  def find_primes_less_than limit
    until @next_candidate &gt; limit
      @primes &lt;&lt; @next_candidate if prime? @next_candidate
      @next_candidate += 1
    end
  end

  def [] index
    until @primes.size &gt; index
      find_primes_less_than @next_candidate + 100
    end
    return @primes[index]
  end
end

</code></pre>
<p>The answer to <a title="Project Euler" href="http://projecteuler.net/index.php?section=problems&amp;id=7">problem #7</a> is @primes[10000], in case you were wondering.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2008/06/21/forgetful-me/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wasting Time</title>
		<link>http://www.raggedclown.com/2008/06/15/wasting-time/</link>
		<comments>http://www.raggedclown.com/2008/06/15/wasting-time/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 22:12:58 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.raggedclown.com/?p=721</guid>
		<description><![CDATA[Project Euler. Wasting time with Maths. My attempt at #3 is running now (which probably means it is wrong).]]></description>
			<content:encoded><![CDATA[<p><a title="Project Euler" href="http://projecteuler.net/">Project Euler</a>. Wasting time with Maths.</p>
<p>My attempt at #3 is running now (which probably means it is wrong).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raggedclown.com/2008/06/15/wasting-time/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

