<?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>Serabe Reloaded &#187; Maths</title>
	<atom:link href="http://www.serabe.com/category/anti-gotam/maths/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serabe.com</link>
	<description>Conecto ergo sum. Non conecto ergo urgueo.</description>
	<lastBuildDate>Sun, 09 Oct 2011 21:30:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Problem 3</title>
		<link>http://www.serabe.com/2008/10/12/problem-3/</link>
		<comments>http://www.serabe.com/2008/10/12/problem-3/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 14:13:42 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyEuler]]></category>
		<category><![CDATA[euler project]]></category>
		<category><![CDATA[problem 3]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[RbEuler]]></category>

		<guid isPermaLink="false">http://www.serabe.com/?p=259</guid>
		<description><![CDATA[Wording: (Original) The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Solution: First the code: PLAIN TEXT RUBY: include Math def prime_factors&#40;num, factor=2&#41; &#160; return &#91;&#93;&#160; if num &#60;= 1 &#160; next_pf = &#40;factor..&#40;sqrt&#40;num&#41;.ceil&#41;&#41;.find&#40;lambda &#123;num&#125;&#41;&#123; &#124;x&#124; num%x == 0 &#125; &#160; return [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Wording:</strong> (<a href="http://projecteuler.net/index.php?section=problems&#038;id=3"  title="Project Euler">Original</a>) The prime factors of 13195 are 5, 7, 13 and 29.<br />
What is the largest prime factor of the number 600851475143 ?</p>
<p><strong>Solution:</strong><br />
First the code:</p>
<div class="igBar"><span id="lruby-2"><a href="#" onclick="javascript:showPlainTxt('ruby-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-2">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">include</span> Math</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> prime_factors<span style="color:#006600; font-weight:bold;">&#40;</span>num, factor=<span style="color:#006666;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> num &lt;= <span style="color:#006666;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; next_pf = <span style="color:#006600; font-weight:bold;">&#40;</span>factor..<span style="color:#006600; font-weight:bold;">&#40;</span>sqrt<span style="color:#006600; font-weight:bold;">&#40;</span>num<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">ceil</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span>num<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> |x| num%x == <span style="color:#006666;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#006600; font-weight:bold;">&#91;</span>next_pf<span style="color:#006600; font-weight:bold;">&#93;</span> + prime_factors<span style="color:#006600; font-weight:bold;">&#40;</span>num/next_pf, next_pf<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> prime_factors<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">600851475143</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">max</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The code is a direct port from the one in PyEuler. It is based mainly in the idea that the first factor of a number is always prime.</p>
<p>Line 3 breaks recursion and line 4 works out the next prime factor (actually, it finds the smallest factor). For doing this, it uses find method. If no element match the criteria, then it returns the number (that is what the lambda block is for).</p>
<p>Finally, line 5 merges the results and line 8 print the result.</p>
<p>This time just one code is showed.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Problem 3 on Serabe Reloaded',url: 'http://www.serabe.com/2008/10/12/problem-3/',contentID: 'post-259',suggestTags: 'euler project,problem 3,programming,RbEuler,Ruby',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Problem 3" alt="article clipper Problem 3" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F10%2F12%2Fproblem-3%2F&amp;title=Problem%203" id="wpa2a_2"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Problem 3"  title="Problem 3" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/10/12/problem-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problema 2</title>
		<link>http://www.serabe.com/2008/03/23/problema-2/</link>
		<comments>http://www.serabe.com/2008/03/23/problema-2/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 21:37:14 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyEuler]]></category>
		<category><![CDATA[euler project]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[RbEuler]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/03/23/problema-2/</guid>
		<description><![CDATA[Enunciado: Suma todos los nÃºmeros pares de la sucesiÃ³n de Fibonacci menores que un cuatro millÃ³n. Primera soluciÃ³n: La primera soluciÃ³n es muy simple. Hay un mÃ©todo que devuelve un array con todos los nÃºmeros de la sucesiÃ³n de Fibonacci menores que un mÃ¡ximo max tomando como inicio un array de dos elementos arr. PLAIN [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Enunciado:</strong><br />
Suma todos los nÃºmeros pares de la sucesiÃ³n de Fibonacci menores que un <em>cuatro</em> millÃ³n.</p>
<p><strong>Primera soluciÃ³n:</strong></p>
<p>La primera soluciÃ³n es muy simple. Hay un mÃ©todo que devuelve un array con todos los nÃºmeros de la sucesiÃ³n de Fibonacci menores que un mÃ¡ximo <em>max</em> tomando como inicio un array de dos elementos <em>arr</em>.</p>
<div class="igBar"><span id="lruby-8"><a href="#" onclick="javascript:showPlainTxt('ruby-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-8">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> fib1<span style="color:#006600; font-weight:bold;">&#40;</span>max,arr=<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;color:#800000;">1</span>,<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span>arr.<span style="color:#9900CC;">last</span> &lt;max<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; arr &lt;&lt;<span style="color:#006600; font-weight:bold;">&#40;</span>arr.<span style="color:#9900CC;">last</span>+arr<span style="color:#006600; font-weight:bold;">&#91;</span>arr.<span style="color:#9900CC;">size</span>-<span style="color:#006666;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; arr.<span style="color:#9900CC;">pop</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; arr</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>DespuÃ©s simplemente se eliminan los impares y se suman los que quedan.</p>
<div class="igBar"><span id="lruby-9"><a href="#" onclick="javascript:showPlainTxt('ruby-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-9">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> euler2a<span style="color:#006600; font-weight:bold;">&#40;</span>max, ini=<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;color:#800000;">1</span>,<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fib1<span style="color:#006600; font-weight:bold;">&#40;</span>max,ini<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">delete_if</span><span style="color:#006600; font-weight:bold;">&#123;</span>|x| x%<span style="color:#006666;color:#800000;">2</span> == <span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#123;</span>|memo,obj| memo+obj<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> euler2a<span style="color:#006600; font-weight:bold;">&#40;</span>4e6<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Segunda soluciÃ³n:</strong></p>
<p>Esta soluciÃ³n es un poco mejor. Se va a hacer un nuevo mÃ©todo que calcule todos los nÃºmeros de la sucesiÃ³n de Fibonacci menores que un mÃ¡ximo <strong>max</strong> pero que sÃ³lo almacene aquellos que pasen una condiciÃ³n que se le pasa como bloque:</p>
<div class="igBar"><span id="lruby-10"><a href="#" onclick="javascript:showPlainTxt('ruby-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-10">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> fib2<span style="color:#006600; font-weight:bold;">&#40;</span>max,a=<span style="color:#006666;color:#800000;">1</span>,b=<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; arr = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; arr &lt;&lt;a <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span>b&lt;max<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; arr &lt;&lt;b <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>b<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; a,b=b,a+b</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; arr</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>DespuÃ©s sÃ³lo hace falta pasar el filtro adecuado, y sumar los resultados:</p>
<div class="igBar"><span id="lruby-11"><a href="#" onclick="javascript:showPlainTxt('ruby-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-11">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> euler2b<span style="color:#006600; font-weight:bold;">&#40;</span>max,a=<span style="color:#006666;color:#800000;">1</span>,b=<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fib2<span style="color:#006600; font-weight:bold;">&#40;</span>max,a,b<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>|x| x%<span style="color:#006666;color:#800000;">2</span>==<span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#123;</span>|memo,obj| memo+obj<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> euler2b<span style="color:#006600; font-weight:bold;">&#40;</span>4e6<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Tercera soluciÃ³n:</strong></p>
<p>Esta tercera soluciÃ³n es una modificaciÃ³n directa de la segunda. En vez de almacenar los datos, se suman directamente.</p>
<div class="igBar"><span id="lruby-12"><a href="#" onclick="javascript:showPlainTxt('ruby-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-12">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> fib3<span style="color:#006600; font-weight:bold;">&#40;</span>max,a=<span style="color:#006666;color:#800000;">1</span>,b=<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; res = <span style="color:#006666;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; res += a <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span>b&lt;max<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; res += b <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>b<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; a,b=b,a+b</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; res</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> euler2c<span style="color:#006600; font-weight:bold;">&#40;</span>max,a=<span style="color:#006666;color:#800000;">1</span>,b=<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fib3<span style="color:#006600; font-weight:bold;">&#40;</span>max,a,b<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>|x| x%<span style="color:#006666;color:#800000;">2</span>==<span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> euler2c<span style="color:#006600; font-weight:bold;">&#40;</span>4e6<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y eso es todo.</p>
<p><strong>ActualizaciÃ³n:</strong> Hay diferencias entre la pÃ¡gina de PyEuler y la del Proyecto Euler. El problema ha sido actualizado para corresponderse con esta Ãºltima.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Problema 2 on Serabe Reloaded',url: 'http://www.serabe.com/2008/03/23/problema-2/',contentID: 'post-165',suggestTags: 'euler project,Maths,Programming,programming,RbEuler,Ruby',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Problema 2" alt="article clipper Problema 2" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F03%2F23%2Fproblema-2%2F&amp;title=Problema%202" id="wpa2a_4"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Problema 2"  title="Problema 2" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/03/23/problema-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweets del 19-03-2008</title>
		<link>http://www.serabe.com/2008/03/19/tweets-del-19-03-2008/</link>
		<comments>http://www.serabe.com/2008/03/19/tweets-del-19-03-2008/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 22:59:59 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/03/19/tweets-del-19-03-2008/</guid>
		<description><![CDATA[Â¿Un objeto imposible? http://tinyurl.com/2nnd7b # &#160;]]></description>
			<content:encoded><![CDATA[<ul>
<li>Â¿Un objeto imposible? <a href="http://tinyurl.com/2nnd7b"  rel="nofollow">http://tinyurl.com/2nnd7b</a> <a href="http://twitter.com/Serabe/statuses/773978883" >#</a></li>
</ul>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Tweets del 19-03-2008 on Serabe Reloaded',url: 'http://www.serabe.com/2008/03/19/tweets-del-19-03-2008/',contentID: 'post-163',suggestTags: 'Maths',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Tweets del 19 03 2008" alt="article clipper Tweets del 19 03 2008" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F03%2F19%2Ftweets-del-19-03-2008%2F&amp;title=Tweets%20del%2019-03-2008" id="wpa2a_6"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Tweets del 19 03 2008"  title="Tweets del 19 03 2008" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/03/19/tweets-del-19-03-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problema 1</title>
		<link>http://www.serabe.com/2008/02/27/problema-1/</link>
		<comments>http://www.serabe.com/2008/02/27/problema-1/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 12:20:56 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Maths]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyEuler]]></category>
		<category><![CDATA[RbEuler]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/02/27/problema-1/</guid>
		<description><![CDATA[Empiezo aquÃ­ una serie de artÃ­culos de periodicidad variable que lo Ãºnico que pretende es ser algo similar (de una manera muy amplia) a PyEuler. La lista completa de problemas estÃ¡ en el Proyecto Euler y, como no podÃ­a ser de otra manera, empiezo por el primero. Enunciado: Halla la suma de todos los nÃºmeros [...]]]></description>
			<content:encoded><![CDATA[<p>Empiezo aquÃ­ una serie de artÃ­culos de periodicidad variable que lo Ãºnico que pretende es ser algo similar (de una manera muy amplia) a <a href="http://pyeuler.wikidot.com/"  title="Sitio de PyEuler">PyEuler</a>. La lista completa de problemas estÃ¡ en el <a href="http://projecteuler.net/"  title="Sitio del Proyecto Euler">Proyecto Euler</a> y, como no podÃ­a ser de otra manera, empiezo por el primero.</p>
<p><strong>Enunciado:</strong><br />
Halla la suma de todos los nÃºmeros menores que 1000 y mÃºltiplos de 3 o de 5.</p>
<p><strong>SoluciÃ³n 1:</strong></p>
<div class="igBar"><span id="lruby-18"><a href="#" onclick="javascript:showPlainTxt('ruby-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-18">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> euler1a<span style="color:#006600; font-weight:bold;">&#40;</span>e, numbers<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">1</span>..<span style="color:#9900CC;">e</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">select</span><span style="color:#006600; font-weight:bold;">&#123;</span>|x| numbers.<span style="color:#9900CC;">any</span>?<span style="color:#006600; font-weight:bold;">&#123;</span>|y| <span style="color:#006600; font-weight:bold;">&#40;</span>x%y == <span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#123;</span>|memo,o| memo+=o<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> euler1a<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">1000</span>,<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;color:#800000;">3</span>,<span style="color:#006666;color:#800000;">5</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
La explicaciÃ³n es simple. Tenemos un rango desde 1 hasta el lÃ­mite, filtramos los que son mÃºltiplos de algÃºn elemento del array y despuÃ©s se suman.</p>
<p><strong>SoluciÃ³n 2:</strong></p>
<div class="igBar"><span id="lruby-19"><a href="#" onclick="javascript:showPlainTxt('ruby-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-19">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> euler1b<span style="color:#006600; font-weight:bold;">&#40;</span>e,numbers<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">1</span>..<span style="color:#9900CC;">e</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span>|memo,o| <span style="color:#006600; font-weight:bold;">&#40;</span>numbers.<span style="color:#9900CC;">any</span>?<span style="color:#006600; font-weight:bold;">&#123;</span>|x| <span style="color:#006600; font-weight:bold;">&#40;</span>o%x<span style="color:#006600; font-weight:bold;">&#41;</span>==<span style="color:#006666;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? memo+o : memo <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> euler1b<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">1000</span>,<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;color:#800000;">3</span>,<span style="color:#006666;color:#800000;">5</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Ã‰ste es similar al anterior, sÃ³lo que se suma segÃºn se recorre el rango.</p>
<p><strong>SoluciÃ³n 3:</strong><br />
Para este necesitamos antes un par de funciones. La primera, halla el mÃ¡ximo comÃºn divisor de dos nÃºmeros. Para ello, bÃ¡sicamente usa el <a rel="nofollow" href="http://es.wikipedia.org/wiki/Algoritmo_de_Euclides"  title="Wikipedia">algoritmo de Euclides</a>.</p>
<div class="igBar"><span id="lruby-20"><a href="#" onclick="javascript:showPlainTxt('ruby-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-20">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> mcd<span style="color:#006600; font-weight:bold;">&#40;</span>n1,n2<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> n1 &lt;n2</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; mcd<span style="color:#006600; font-weight:bold;">&#40;</span>n2,n1<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#006600; font-weight:bold;">&#40;</span>n1%n2<span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#006666;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; n2</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; mcd<span style="color:#006600; font-weight:bold;">&#40;</span>n2,n1%n2<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Por otra parte, estÃ¡ la funciÃ³n que calcula el mÃ­nimo comÃºn mÃºltiplo. Para ello usa su relaciÃ³n con el <abbr title="MÃ¡ximo ComÃºn Divisor">m.c.d.</abbr>.</p>
<div class="igBar"><span id="lruby-21"><a href="#" onclick="javascript:showPlainTxt('ruby-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-21">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> mcm<span style="color:#006600; font-weight:bold;">&#40;</span>n1,n2<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; n1*n2/mcd<span style="color:#006600; font-weight:bold;">&#40;</span>n1,n2<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Con esto, ya podemos pasar a la tercera soluciÃ³n, que es diferente de las otras dos en que sÃ³lo sirve si utilizamos dos nÃºmeros como filtro.</p>
<div class="igBar"><span id="lruby-22"><a href="#" onclick="javascript:showPlainTxt('ruby-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-22">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> euler1c<span style="color:#006600; font-weight:bold;">&#40;</span>limit, n1, n2<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span>n1*<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>limit/n1<span style="color:#006600; font-weight:bold;">&#41;</span>*<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>limit/n1<span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>/<span style="color:#006666;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>+n2*<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>limit/n2<span style="color:#006600; font-weight:bold;">&#41;</span>*<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>limit/n2<span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>/<span style="color:#006666;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>-mcm<span style="color:#006600; font-weight:bold;">&#40;</span>n1,n2<span style="color:#006600; font-weight:bold;">&#41;</span>*<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>limit/mcm<span style="color:#006600; font-weight:bold;">&#40;</span>n1,n2<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>*<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>limit/mcm<span style="color:#006600; font-weight:bold;">&#40;</span>n1,n2<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#006666;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>/<span style="color:#006666;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> euler1c<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;color:#800000;">1000</span>,<span style="color:#006666;color:#800000;">3</span>,<span style="color:#006666;color:#800000;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La explicaciÃ³n es un poco mÃ¡s complicada, pues implica teorÃ­a bÃ¡sica de conjuntos y la conocida fÃ³rmula de la suma de 1 a n.</p>
<p>Ahora es vuestro turno. Â¿CÃ³mo se os ocurre hacerlo?</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Problema 1 on Serabe Reloaded',url: 'http://www.serabe.com/2008/02/27/problema-1/',contentID: 'post-148',suggestTags: 'Maths,RbEuler,Ruby',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Problema 1" alt="article clipper Problema 1" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F02%2F27%2Fproblema-1%2F&amp;title=Problema%201" id="wpa2a_8"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Problema 1"  title="Problema 1" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/02/27/problema-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweets del 24-02-2008</title>
		<link>http://www.serabe.com/2008/02/24/tweets-del-24-02-2008/</link>
		<comments>http://www.serabe.com/2008/02/24/tweets-del-24-02-2008/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 22:59:59 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Videojuegos]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[antlr]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[cupones descuento]]></category>
		<category><![CDATA[escepticismo]]></category>
		<category><![CDATA[gordon freeman]]></category>
		<category><![CDATA[house]]></category>
		<category><![CDATA[kirby]]></category>
		<category><![CDATA[mensaje de Arecibo]]></category>
		<category><![CDATA[nintendo]]></category>
		<category><![CDATA[programación C]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/02/24/tweets-del-24-02-2008/</guid>
		<description><![CDATA[Cupones de descuento http://www.retailmenot.com/ # Gregory Freeman &#124;&#124; Gordon House http://tinyurl.com/33h2zx # Diccionario del escÃ©ptico http://www.skepdic.com/tilogic.html # 100 Kirbies http://www.vgcats.com/comics/ # EvoluciÃ³n de Nintendo http://tinyurl.com/2pbzgj # El mensaje de Arecibo explicado http://tinyurl.com/3yut35 # Los 10 mejores trucos de CSS http://tinyurl.com/3c8lmp # Manual de Vim http://www.moolenaar.net/habits.html # CÃ³mo leer declaraciones en C http://tinyurl.com/2johzr # Manual de [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Cupones de descuento <a href="http://www.retailmenot.com/"  rel="nofollow">http://www.retailmenot.com/</a> <a href="http://twitter.com/Serabe/statuses/751196722" >#</a></li>
<li>Gregory Freeman || Gordon House <a href="http://tinyurl.com/33h2zx"  rel="nofollow">http://tinyurl.com/33h2zx</a> <a href="http://twitter.com/Serabe/statuses/751209262" >#</a></li>
<li>Diccionario del escÃ©ptico <a href="http://www.skepdic.com/tilogic.html"  rel="nofollow">http://www.skepdic.com/tilogic.html</a> <a href="http://twitter.com/Serabe/statuses/751325762" >#</a></li>
<li>100 Kirbies <a href="http://www.vgcats.com/comics/"  rel="nofollow">http://www.vgcats.com/comics/</a> <a href="http://twitter.com/Serabe/statuses/751445582" >#</a></li>
<li>EvoluciÃ³n de Nintendo <a href="http://tinyurl.com/2pbzgj"  rel="nofollow">http://tinyurl.com/2pbzgj</a> <a href="http://twitter.com/Serabe/statuses/751465332" >#</a></li>
<li>El mensaje de Arecibo explicado <a href="http://tinyurl.com/3yut35"  rel="nofollow">http://tinyurl.com/3yut35</a> <a href="http://twitter.com/Serabe/statuses/752314512" >#</a></li>
<li>Los 10 mejores trucos de CSS <a href="http://tinyurl.com/3c8lmp"  rel="nofollow">http://tinyurl.com/3c8lmp</a> <a href="http://twitter.com/Serabe/statuses/752530722" >#</a></li>
<li>Manual de Vim <a href="http://www.moolenaar.net/habits.html"  rel="nofollow">http://www.moolenaar.net/habits.html</a> <a href="http://twitter.com/Serabe/statuses/752566412" >#</a></li>
<li>CÃ³mo leer declaraciones en C <a href="http://tinyurl.com/2johzr"  rel="nofollow">http://tinyurl.com/2johzr</a> <a href="http://twitter.com/Serabe/statuses/752662582" >#</a></li>
<li>Manual de ANTLR <a href="http://tinyurl.com/3bz4hz"  rel="nofollow">http://tinyurl.com/3bz4hz</a> <a href="http://twitter.com/Serabe/statuses/752728362" >#</a></li>
</ul>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Tweets del 24-02-2008 on Serabe Reloaded',url: 'http://www.serabe.com/2008/02/24/tweets-del-24-02-2008/',contentID: 'post-146',suggestTags: 'antlr,css,cupones descuento,escepticismo,gordon freeman,house,kirby,mensaje de Arecibo,nintendo,programación C,vim',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Tweets del 24 02 2008" alt="article clipper Tweets del 24 02 2008" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F02%2F24%2Ftweets-del-24-02-2008%2F&amp;title=Tweets%20del%2024-02-2008" id="wpa2a_10"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Tweets del 24 02 2008"  title="Tweets del 24 02 2008" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/02/24/tweets-del-24-02-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweets del 15-02-2008</title>
		<link>http://www.serabe.com/2008/02/15/tweets-del-15-02-2008/</link>
		<comments>http://www.serabe.com/2008/02/15/tweets-del-15-02-2008/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 21:59:59 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Criptography]]></category>
		<category><![CDATA[Fotos]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[Juegos]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/02/15/tweets-del-15-02-2008/</guid>
		<description><![CDATA[Born to Be Wild http://tinyurl.com/yoc3xj # 234 Free Online Cryptogram Puzzles http://tinyurl.com/3dmm7o # &#160;]]></description>
			<content:encoded><![CDATA[<ul>
<li>Born to Be Wild <a href="http://tinyurl.com/yoc3xj"  rel="nofollow">http://tinyurl.com/yoc3xj</a> <a href="http://twitter.com/Serabe/statuses/715589082" >#</a></li>
<li>234 Free Online Cryptogram Puzzles <a href="http://tinyurl.com/3dmm7o"  rel="nofollow">http://tinyurl.com/3dmm7o</a> <a href="http://twitter.com/Serabe/statuses/715733222" >#</a></li>
</ul>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Tweets del 15-02-2008 on Serabe Reloaded',url: 'http://www.serabe.com/2008/02/15/tweets-del-15-02-2008/',contentID: 'post-139',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Tweets del 15 02 2008" alt="article clipper Tweets del 15 02 2008" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F02%2F15%2Ftweets-del-15-02-2008%2F&amp;title=Tweets%20del%2015-02-2008" id="wpa2a_12"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Tweets del 15 02 2008"  title="Tweets del 15 02 2008" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/02/15/tweets-del-15-02-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweets del 13-02-2008</title>
		<link>http://www.serabe.com/2008/02/13/tweets-del-13-02-2008/</link>
		<comments>http://www.serabe.com/2008/02/13/tweets-del-13-02-2008/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 21:59:59 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Fotos]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[StumbleUpon]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2008/02/13/tweets-del-13-02-2008/</guid>
		<description><![CDATA[Comandos para Mac http://tinyurl.com/2bemuc # Transformaciones de MÃ¶ebius al descubierto http://tinyurl.com/3x22jy # Un poco de humor polÃ­tico http://tinyurl.com/yupbcc # Cubo de Yoshimoto. http://tinyurl.com/26hgrf # Computer Programming Algorithms Directory http://tinyurl.com/a25v3 # And She Stares Longingly at What She Has Lost, increÃ­ble corto. http://tinyurl.com/2ddxm9 # Fotos tomadas en los momentos mÃ¡s oportunos. http://tinyurl.com/ys3s4r # &#160;]]></description>
			<content:encoded><![CDATA[<ul>
<li>Comandos para Mac <a href="http://tinyurl.com/2bemuc"  rel="nofollow">http://tinyurl.com/2bemuc</a> <a href="http://twitter.com/Serabe/statuses/708744742" >#</a></li>
<li>Transformaciones de MÃ¶ebius al descubierto <a href="http://tinyurl.com/3x22jy"  rel="nofollow">http://tinyurl.com/3x22jy</a> <a href="http://twitter.com/Serabe/statuses/708790592" >#</a></li>
<li>Un poco de humor polÃ­tico <a href="http://tinyurl.com/yupbcc"  rel="nofollow">http://tinyurl.com/yupbcc</a> <a href="http://twitter.com/Serabe/statuses/709008182" >#</a></li>
<li>Cubo de Yoshimoto. <a href="http://tinyurl.com/26hgrf"  rel="nofollow">http://tinyurl.com/26hgrf</a> <a href="http://twitter.com/Serabe/statuses/709146032" >#</a></li>
<li>Computer Programming Algorithms Directory <a href="http://tinyurl.com/a25v3"  rel="nofollow">http://tinyurl.com/a25v3</a> <a href="http://twitter.com/Serabe/statuses/709170072" >#</a></li>
<li>And She Stares Longingly at What She Has Lost, increÃ­ble corto.  <a href="http://tinyurl.com/2ddxm9"  rel="nofollow">http://tinyurl.com/2ddxm9</a> <a href="http://twitter.com/Serabe/statuses/709223192" >#</a></li>
<li>Fotos tomadas en los momentos mÃ¡s oportunos. <a href="http://tinyurl.com/ys3s4r"  rel="nofollow">http://tinyurl.com/ys3s4r</a> <a href="http://twitter.com/Serabe/statuses/709271382" >#</a></li>
</ul>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Tweets del 13-02-2008 on Serabe Reloaded',url: 'http://www.serabe.com/2008/02/13/tweets-del-13-02-2008/',contentID: 'post-137',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Tweets del 13 02 2008" alt="article clipper Tweets del 13 02 2008" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2008%2F02%2F13%2Ftweets-del-13-02-2008%2F&amp;title=Tweets%20del%2013-02-2008" id="wpa2a_14"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Tweets del 13 02 2008"  title="Tweets del 13 02 2008" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2008/02/13/tweets-del-13-02-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MatemÃ¡ticas egipcias.</title>
		<link>http://www.serabe.com/2006/10/23/matematicas-egipcias/</link>
		<comments>http://www.serabe.com/2006/10/23/matematicas-egipcias/#comments</comments>
		<pubDate>Sun, 22 Oct 2006 22:58:16 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[History]]></category>
		<category><![CDATA[Maths]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2006/10/23/matematicas-egipcias/</guid>
		<description><![CDATA[Hace medio mes empecÃ© mis clases en la Universidad. En Historia de la matemÃ¡tica estamos a punto de llegar a los egipcios, cuya matemÃ¡tica resulta curiosa. Fracciones unitarias. Los egipcios ya conocÃ­an las fracciones aunque no todas le "gustaban". De hecho, sÃ³lo le gustaban las fracciones unitarias (aquellas en las que el numerador es la [...]]]></description>
			<content:encoded><![CDATA[<p>Hace medio mes <a href="http://www.serabe.com/2006/10/03/mi-primer-dia-fue-ayer/" title="Post Originial" >empecÃ© mis clases en la Universidad</a>. En Historia de la matemÃ¡tica estamos a punto de llegar a los egipcios, cuya matemÃ¡tica resulta curiosa.</p>
<p><strong>Fracciones unitarias.</strong><br />
Los egipcios ya conocÃ­an las fracciones aunque no todas le "gustaban". De hecho, sÃ³lo le gustaban las fracciones unitarias (aquellas en las que el numerador es la unidad) y sÃ³lo tenÃ­a como excepciÃ³n (o capricho, segÃºn se mire): la fracciÃ³n 2/3. AsÃ­, si se encontraban con una distinta, la transformaban en un sumatorio de fracciones unitarias.</p>
<p>Para pasar una fracciÃ³n del tipo 2/2k a fracciÃ³n unitaria es muy sencillo: 2/2k = 1/k. El problema viene con fracciones del tipo 2/n con n impar. En el <a rel="nofollow" href="http://es.wikipedia.org/wiki/Papiro_de_Ahmes" title="Wikipedia" >papiro de Ahmes</a> o de Rhind se encuentra una tabla con algunas descomposiciones con fracciones de dicho tipo,  exactamente para todos los impares comprendidos entre 3 y 101, ambos inclusive. Sorprende que dichas descomposiciones no son las mÃ¡s "lÃ³gicas", es decir, si tenemos 2/k usar 1/k+1/k. De hecho, nadie sabe porquÃ© se eligieron <a href="http://www.egiptologia.org/ciencia/matematicas/papiro_rhind.htm" title="InformaciÃ³n sobre el papiro Rhind" >esas descomposiciones</a> y no otras, aunque la mayorÃ­a son una de las opciones mÃ¡s simples de descomposociÃ³n.</p>
<p><strong>MultiplicaciÃ³n.</strong><br />
Para multiplicar usaban un sistema muy interesante, el de la duplicaciÃ³n. BÃ¡sicamente, no es muy diferente a la tÃ©cnica que todos usamos en un principio: la de sumar repetidamente. La Ãºnica diferencia es que iban multiplicando por dos de forma consecutiva. AsÃ­, para multiplicar 4x13:</p>
<p>1 -------------    4<br />
2 -------------   8<br />
4 ------------- 16<br />
8 ------------- 32</p>
<p>AsÃ­ se tiene que 52 = 32 + 16 + 4 = 4Â·8 + 4Â·4 + 4Â·1 = 4Â·(8 + 4 + 1) = 4 Â· 13. Que es lo que buscÃ¡bamos. Para demostrar que es posible con cualquier nÃºmero, sÃ³lo hace falta reseÃ±ar que se basa en que cualquier nÃºmero es expresable en base 2.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'MatemÃ¡ticas egipcias. on Serabe Reloaded',url: 'http://www.serabe.com/2006/10/23/matematicas-egipcias/',contentID: 'post-27',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="MatemÃ¡ticas egipcias." alt="article clipper MatemÃ¡ticas egipcias." />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2006%2F10%2F23%2Fmatematicas-egipcias%2F&amp;title=Matem%C3%83%C2%A1ticas%20egipcias." id="wpa2a_16"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 MatemÃ¡ticas egipcias."  title="MatemÃ¡ticas egipcias." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2006/10/23/matematicas-egipcias/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Su carencia de fe resulta molesta</title>
		<link>http://www.serabe.com/2006/09/27/su-carencia-de-fe-resulta-molesta/</link>
		<comments>http://www.serabe.com/2006/09/27/su-carencia-de-fe-resulta-molesta/#comments</comments>
		<pubDate>Tue, 26 Sep 2006 22:55:09 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Cine]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Sci-Fi]]></category>
		<category><![CDATA[StarWars]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2006/09/27/su-carencia-de-fe-resulta-molesta/</guid>
		<description><![CDATA["Se traslada a este prisionero desde el bloque uno uno tres ocho" dice Luke Skywalker en La Guerra de las Galaxias: Una nueva esperanza. Ayer me comprÃ© la ediciÃ³n limitada de la primera trilogÃ­a. SÃ­, esa en la que viene como "extra" la versiÃ³n estrenada en cines. La verdad es que aÃºn no he podido [...]]]></description>
			<content:encoded><![CDATA[<p>"Se traslada a este prisionero desde el bloque uno uno tres ocho" dice <a rel="nofollow" href="http://es.wikipedia.org/wiki/Luke_Skywalker" title="Wikipedia" >Luke Skywalker</a> en <a rel="nofollow" href="http://www.imdb.com/title/tt0076759/" title="IMDB" >La Guerra de las Galaxias: Una nueva esperanza</a>.<br />
Ayer me comprÃ© la ediciÃ³n limitada de la primera trilogÃ­a. SÃ­, esa en la que viene como "extra" la versiÃ³n estrenada en cines. La verdad es que aÃºn no he podido ver las tres, de hecho mientras escribo estoy terminando de ver la primera.</p>
<p>Resulta que ese uno-uno-tres-ocho forma parte del tÃ­tulo del primer largometraje de <a rel="nofollow" href="http://es.wikipedia.org/wiki/George_Lucas" title="Wikipedia" >George Lucas</a>: <em>THX-1138</em>. AsÃ­ pues, me he puesto a indagar sobre ello y he encontrado <a href="http://www.starwars.com/episode-iv/release/video/f20040909/index.html" title="StarWars.com" >esta pÃ¡gina</a>. En ella se descubre, Â¡oh, quÃ© casualidad! que es la primera vez que aparece la palabra <a href="http://www.starwars.com/databank/species/wookiee/" title="StarWars.com" >Wookie</a> en el cine.</p>
<p>Como todos (aquellos que hayan visto la pelÃ­cula) recordarÃ¡n, poco despuÃ©s caen en un triturador de basura. Lo que no todos recordarÃ¡n es que el nÃºmero de dicho triturador es 3263827. Este nÃºmero me ha resultado curioso y me he puesto a investigar. Lo primero, como siempre, es saber su factorizaciÃ³n en nÃºmeros primos. Por el <a rel="nofollow" href="http://es.wikipedia.org/wiki/Teorema_fundamental_de_la_Aritm%C3%A9tica" title="Wikipedia" >Teorema fundamental de la AritmÃ©tica</a>, dicha factorizaciÃ³n es Ãºnica, salvo el orden. Al descomponerlo, resulta curioso que sÃ³lo tenga dos factores primos: el 7 y el 466261 (no soy el <a href="http://www.mathcounts.org/webarticles/anmviewer.asp?a=64" title="MathCounts" >primero</a> en fijarme en esto). No creo que George Lucas haya estado haciendo nÃºmeros, pero resulta que 1138 tambiÃ©n se descompone en dos factores primos: 2 y 569.</p>
<p>Tengo mucho tiempo libre <abbr title="Quod Erat Demonstrandum">Q.E.D.</abbr></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Su carencia de fe resulta molesta on Serabe Reloaded',url: 'http://www.serabe.com/2006/09/27/su-carencia-de-fe-resulta-molesta/',contentID: 'post-17',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="Su carencia de fe resulta molesta" alt="article clipper Su carencia de fe resulta molesta" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2006%2F09%2F27%2Fsu-carencia-de-fe-resulta-molesta%2F&amp;title=Su%20carencia%20de%20fe%20resulta%20molesta" id="wpa2a_18"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Su carencia de fe resulta molesta"  title="Su carencia de fe resulta molesta" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2006/09/27/su-carencia-de-fe-resulta-molesta/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One group to rule them all.</title>
		<link>http://www.serabe.com/2006/09/14/one-group-to-rule-them-all/</link>
		<comments>http://www.serabe.com/2006/09/14/one-group-to-rule-them-all/#comments</comments>
		<pubDate>Wed, 13 Sep 2006 22:21:31 +0000</pubDate>
		<dc:creator>Serabe</dc:creator>
				<category><![CDATA[Anti-GOTAM]]></category>
		<category><![CDATA[Maths]]></category>

		<guid isPermaLink="false">http://www.serabe.com/2006/09/14/one-group-to-rule-them-all/</guid>
		<description><![CDATA[Dedicado a un matemÃ¡tico en ciernes, este post tratarÃ¡ de una simple definiciÃ³n del concepto matemÃ¡tico de Grupo, tal vez el primer obstaculillo que se encuentra el estudiante al empezar la carrera. Un grupo se compone de un conjunto de elementos (por ejemplo, X) y una operaciÃ³n binaria (por ejemplo, *) que cumplen los siguientes [...]]]></description>
			<content:encoded><![CDATA[<p>Dedicado a un <abbr title="Hola, Ãngel">matemÃ¡tico en ciernes</abbr>, este post tratarÃ¡ de una simple definiciÃ³n del concepto matemÃ¡tico de <a rel="nofollow" href="http://es.wikipedia.org/wiki/Grupo_matem%C3%A1tico" title="Wikipedia" >Grupo</a>, tal vez el primer obstaculillo que se encuentra el estudiante al empezar la carrera.</p>
<p>Un grupo se compone de un conjunto de elementos (por ejemplo, X) y una operaciÃ³n binaria (por ejemplo, *) que cumplen los siguientes requisitos:</p>
<ol>
<li>La operaciÃ³n ha de ser cerrada. Esto quiere decir que cogiendo dos elementos cualquiera de X, se tiene que al aplicar la operaciÃ³n nos da otro elemento de X. En lenguaje matemÃ¡tico se expresa asÃ­: âˆ€ x,y âˆˆ X | x*y âˆˆ X.</li>
<li>La operaciÃ³n ha de poseer la propiedad asociativa, es decir: âˆ€ a,b,c âˆˆ X | a*(b*c) = (a*b)*c.</li>
<li>Ha de existir un elemento neutro e que verifique que âˆ€ x âˆˆ X | e*x = x*e = x.</li>
<li>Ha de existir un elemento inverso x' âˆˆ X | x*x' = x'*x= e.</li>
</ol>
<p>AdemÃ¡s, si se da la conmutatividad (es decir, para dos elementos cualquiera x,y âˆˆ X se verifica que x*y = y*x) tenemos que es un grupo <em>abeliano o conmutativo.</em></p>
<p>Todo este rollo viene para introducir el grupo abeliano de cuatro elementos, o grupo de Klein, que consta de los elementos a,b,c,1. Para terminar de definirlo, sÃ³lo hace falta decir que c=ab y que aa=1, bb=1, siendo 1 el elemento neutro del grupo.</p>
<p>Resulta que, visitando la pÃ¡gina del difunto <a rel="nofollow" href="http://es.wikipedia.org/wiki/Miguel_de_Guzm%C3%A1n" title="Wikipedia" >Miguel de GuzmÃ¡n</a>, me encuentro que dicho grupo de Klein se puede emplear para demostrar si una situaciÃ³n final es vÃ¡lida o no en uno de los solitarios de tablero. El artÃ­culo completo se encuentra <a href="http://www.mat.ucm.es/deptos/am/guzman/cuentosconcuentas/gruposolitarios/gruposolitarios0003.htm" title="UCM" >aquÃ­</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'One group to rule them all. on Serabe Reloaded',url: 'http://www.serabe.com/2006/09/14/one-group-to-rule-them-all/',contentID: 'post-9',suggestTags: '',providerName: 'Serabe Reloaded',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper.png" class="evernoteSiteMemoryButton" title="One group to rule them all." alt="article clipper One group to rule them all." />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.serabe.com%2F2006%2F09%2F14%2Fone-group-to-rule-them-all%2F&amp;title=One%20group%20to%20rule%20them%20all." id="wpa2a_20"><img src="http://www.serabe.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 One group to rule them all."  title="One group to rule them all." /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.serabe.com/2006/09/14/one-group-to-rule-them-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

