<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Math Less Traveled</title>
	<atom:link href="http://mathlesstraveled.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mathlesstraveled.com</link>
	<description>Explorations in mathematical beauty</description>
	<lastBuildDate>Sat, 18 Feb 2012 16:22:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mathlesstraveled.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Math Less Traveled</title>
		<link>http://mathlesstraveled.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mathlesstraveled.com/osd.xml" title="The Math Less Traveled" />
	<atom:link rel='hub' href='http://mathlesstraveled.com/?pushpress=hub'/>
		<item>
		<title>Combinatorial proofs</title>
		<link>http://mathlesstraveled.com/2012/02/17/combinatorial-proofs/</link>
		<comments>http://mathlesstraveled.com/2012/02/17/combinatorial-proofs/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 13:49:08 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[combinatorics]]></category>
		<category><![CDATA[pictures]]></category>
		<category><![CDATA[proof]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1525</guid>
		<description><![CDATA[Continuing from a previous post, we found that if we begin with th powers of consecutive integers and then repeatedly take successive differences, it seems like we always end up with the factorial of , that is, . We then &#8230; <a href="http://mathlesstraveled.com/2012/02/17/combinatorial-proofs/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1525&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Continuing from <a href="http://mathlesstraveled.com/2012/02/16/differences-of-powers-of-consecutive-integers-part-ii/">a previous post</a>, we found that if we begin with <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />th powers of <img src='http://s0.wp.com/latex.php?latex=%28n%2B1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(n+1)' title='(n+1)' class='latex' /> consecutive integers and then repeatedly take successive differences, it seems like we always end up with the factorial of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />, that is, <img src='http://s0.wp.com/latex.php?latex=n%21+%3D+1+%5Ccdot+2+%5Ccdot+3+%5Ccdot+%5Cdots+%5Ccdot+n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n! = 1 &#92;cdot 2 &#92;cdot 3 &#92;cdot &#92;dots &#92;cdot n' title='n! = 1 &#92;cdot 2 &#92;cdot 3 &#92;cdot &#92;dots &#92;cdot n' class='latex' />. We then derived an algebraic expression for the result of the iterative difference procedure. So the goal now is to prove that</p>
<p><div align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Csum_%7Bi%3D0%7D%5En+%28-1%29%5E%7Bn-i%7D+%5Cbinom+n+i+%28k%2Bi%29%5En+%3D+n%21&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle &#92;sum_{i=0}^n (-1)^{n-i} &#92;binom n i (k+i)^n = n!' title='&#92;displaystyle &#92;sum_{i=0}^n (-1)^{n-i} &#92;binom n i (k+i)^n = n!' class='latex' /></div>
</p>
<p>that is,</p>
<p><div align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%28-1%29%5En+%5Cbinom+n+0+k%5En+%2B+%28-1%29%5E%7Bn-1%7D+%5Cbinom+n+1+%28k%2B1%29%5En+%2B+%5Cdots+%2B+%5Cbinom+n+n+%28k%2Bn%29%5En+%3D+n%21&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle (-1)^n &#92;binom n 0 k^n + (-1)^{n-1} &#92;binom n 1 (k+1)^n + &#92;dots + &#92;binom n n (k+n)^n = n!' title='&#92;displaystyle (-1)^n &#92;binom n 0 k^n + (-1)^{n-1} &#92;binom n 1 (k+1)^n + &#92;dots + &#92;binom n n (k+n)^n = n!' class='latex' /></div>
</p>
<p>Now, it&#8217;s possible (probable, in fact) that this can be proved by purely algebraic means. If you come up with such a proof I would love to see it! But I must confess that I spent several hours banging my head against it (algebraically speaking) without making any progress. Eventually I turned to the idea of a <em>combinatorial</em> proof.</p>
<p>What do I mean by that? <em>Combinatorics</em> is the subfield of mathematics concerned with <em>counting</em>. The essence of a combinatorial proof is to show that two different expressions are just two different ways of counting the same set of objects&#8212;and must therefore be equal. I&#8217;ve <a href="http://mathlesstraveled.com/2009/04/14/distributing-cookies-solutions/">described some combinatorial proofs before</a>, in counting the number of ways to distribute cookies.</p>
<p>As another simple example, consider the <a href="http://mathlesstraveled.com/2007/02/14/binomial-coefficients/">binomial coefficient</a> identity</p>
<p><div align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Cbinom+n+k+%3D+%5Cbinom+%7Bn-1%7D%7Bk%7D+%2B+%5Cbinom%7Bn-1%7D%7Bk-1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle &#92;binom n k = &#92;binom {n-1}{k} + &#92;binom{n-1}{k-1}' title='&#92;displaystyle &#92;binom n k = &#92;binom {n-1}{k} + &#92;binom{n-1}{k-1}' class='latex' /></div>
</p>
<p>It&#8217;s certainly possible to prove this algebraically, by expanding out the binomial coefficients (using <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+n+k+%3D+%5Cfrac%7Bn%21%7D%7Bk%21%28n-k%29%21%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom n k = &#92;frac{n!}{k!(n-k)!}' title='&#92;binom n k = &#92;frac{n!}{k!(n-k)!}' class='latex' />), but we can give a more elegant proof, based on the fact that <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+n+k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom n k' title='&#92;binom n k' class='latex' /> is the number of ways to choose a subset of <img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' /> things out of a set of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> things. For example, here are the <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+5+3+%3D+10&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom 5 3 = 10' title='&#92;binom 5 3 = 10' class='latex' /> ways to choose three things out a set of five:</p>
<p><a href="http://mathlesstraveled.files.wordpress.com/2012/02/binom-5-3.png"><img src="http://mathlesstraveled.files.wordpress.com/2012/02/binom-5-3.png?w=640" alt="Size-3 subsets of a set of size 5" title="Size-3 subsets of a set of size 5"   class="aligncenter size-full wp-image-1531" /></a>
<p>Consider the <em>first</em> element of the size-<img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> set. Every subset of size <img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' /> either includes this first element, or it doesn&#8217;t. The number of size-<img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' /> subsets which do <em>not</em> include the first element is <img src='http://s0.wp.com/latex.php?latex=%5Cbinom%7Bn-1%7D%7Bk%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom{n-1}{k}' title='&#92;binom{n-1}{k}' class='latex' />, since that&#8217;s the number of ways to choose <img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' /> things from the remaining <img src='http://s0.wp.com/latex.php?latex=n-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n-1' title='n-1' class='latex' /> elements. The number of size-<img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' /> subsets which <em>do</em> include the first element is <img src='http://s0.wp.com/latex.php?latex=%5Cbinom%7Bn-1%7D%7Bk-1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom{n-1}{k-1}' title='&#92;binom{n-1}{k-1}' class='latex' />, because they correspond to choosing <img src='http://s0.wp.com/latex.php?latex=k-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k-1' title='k-1' class='latex' /> of the remaining <img src='http://s0.wp.com/latex.php?latex=n-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n-1' title='n-1' class='latex' /> things. Therefore <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+n+k+%3D+%5Cbinom%7Bn-1%7D%7Bk%7D+%2B+%5Cbinom%7Bn-1%7D%7Bk-1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom n k = &#92;binom{n-1}{k} + &#92;binom{n-1}{k-1}' title='&#92;binom n k = &#92;binom{n-1}{k} + &#92;binom{n-1}{k-1}' class='latex' />.</p>
<p>Here&#8217;s an illustration of how this works in the particular case when <img src='http://s0.wp.com/latex.php?latex=n+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n = 5' title='n = 5' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=k+%3D+3&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k = 3' title='k = 3' class='latex' />:</p>
<p><a href="http://mathlesstraveled.files.wordpress.com/2012/02/binom-5-3-sm.png"><img src="http://mathlesstraveled.files.wordpress.com/2012/02/binom-5-3-sm.png?w=640" alt="Size-3 subsets of 5 elements, grouped by first element" title="Size-3 subsets of 5 elements, grouped by first element"   class="aligncenter size-full wp-image-1533" /></a>
<p>Notice how the ten subsets from above have been split into two groups: the first group, on the left, are those that don&#8217;t include the first element; you can see that each of them corresponds to one of the <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+4+3+%3D+4&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom 4 3 = 4' title='&#92;binom 4 3 = 4' class='latex' /> size-<img src='http://s0.wp.com/latex.php?latex=3&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='3' title='3' class='latex' /> subsets of the remaining four elements. The second group, on the right, are those that do include the first element; each corresponds to one of the <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+4+2+%3D+6&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom 4 2 = 6' title='&#92;binom 4 2 = 6' class='latex' /> size-<img src='http://s0.wp.com/latex.php?latex=2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2' title='2' class='latex' /> subsets of the remaining four elements.</p>
<p>So that&#8217;s the idea of a combinatorial proof. And we want to do something similar for the identity we are trying to prove&#8212;although, of course, it&#8217;s going to be a bit more difficult!</p>
<p>You might have fun trying to think about what a combinatorial proof of our target equation might look like; although if you don&#8217;t have much experience with combinatorics you may have trouble coming up with what sorts of things the two sides of the equation might be counting! That&#8217;s what I&#8217;ll talk about in my next post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1525/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1525/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1525/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1525&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/02/17/combinatorial-proofs/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2012/02/binom-5-3.png" medium="image">
			<media:title type="html">Size-3 subsets of a set of size 5</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2012/02/binom-5-3-sm.png" medium="image">
			<media:title type="html">Size-3 subsets of 5 elements, grouped by first element</media:title>
		</media:content>
	</item>
		<item>
		<title>Differences of powers of consecutive integers, part II</title>
		<link>http://mathlesstraveled.com/2012/02/16/differences-of-powers-of-consecutive-integers-part-ii/</link>
		<comments>http://mathlesstraveled.com/2012/02/16/differences-of-powers-of-consecutive-integers-part-ii/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 00:52:20 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[arithmetic]]></category>
		<category><![CDATA[iteration]]></category>
		<category><![CDATA[pascal's triangle]]></category>
		<category><![CDATA[binomial coefficients]]></category>
		<category><![CDATA[consecutive]]></category>
		<category><![CDATA[difference]]></category>
		<category><![CDATA[integers]]></category>
		<category><![CDATA[powers]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1444</guid>
		<description><![CDATA[If you spent some time playing around with the procedure from Differences of powers of consecutive integers (namely, raise consecutive integers to the th power, and repeatedly take pairwise differences until reaching a single number) you probably noticed the curious &#8230; <a href="http://mathlesstraveled.com/2012/02/16/differences-of-powers-of-consecutive-integers-part-ii/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1444&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you spent some time playing around with the procedure from <a href="http://mathlesstraveled.com/2012/01/29/differences-of-powers-of-consecutive-integers/">Differences of powers of consecutive integers</a> (namely, raise <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n+1' title='n+1' class='latex' /> consecutive integers to the <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />th power, and repeatedly take pairwise differences until reaching a single number) you probably noticed the curious fact that it always seems to result in a factorial&#8212;in the factorial of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />, to be precise.</p>
<p>For example:</p>
<p><img src='http://s0.wp.com/latex.php?latex=3%5E2%2C+4%5E2%2C+5%5E2+%3D+9%2C16%2C25+%5Cto+7%2C9+%5Cto+2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='3^2, 4^2, 5^2 = 9,16,25 &#92;to 7,9 &#92;to 2' title='3^2, 4^2, 5^2 = 9,16,25 &#92;to 7,9 &#92;to 2' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=196%5E2%2C+197%5E2%2C+198%5E2+%3D+38416%2C38809%2C39204+%5Cto+393%2C395+%5Cto+2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='196^2, 197^2, 198^2 = 38416,38809,39204 &#92;to 393,395 &#92;to 2' title='196^2, 197^2, 198^2 = 38416,38809,39204 &#92;to 393,395 &#92;to 2' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=7%5E3%2C+8%5E3%2C+9%5E3%2C+10%5E3+%3D+343%2C512%2C729%2C1000+%5Cto+169%2C217%2C271+%5Cto+48%2C54+%5Cto+6&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='7^3, 8^3, 9^3, 10^3 = 343,512,729,1000 &#92;to 169,217,271 &#92;to 48,54 &#92;to 6' title='7^3, 8^3, 9^3, 10^3 = 343,512,729,1000 &#92;to 169,217,271 &#92;to 48,54 &#92;to 6' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=0%5E4%2C1%5E4%2C2%5E4%2C3%5E4%2C4%5E4+%3D+0%2C1%2C16%2C81%2C256+%5Cto+1%2C15%2C65%2C175+%5Cto+14%2C50%2C110+%5Cto+36%2C60+%5Cto+24&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='0^4,1^4,2^4,3^4,4^4 = 0,1,16,81,256 &#92;to 1,15,65,175 &#92;to 14,50,110 &#92;to 36,60 &#92;to 24' title='0^4,1^4,2^4,3^4,4^4 = 0,1,16,81,256 &#92;to 1,15,65,175 &#92;to 14,50,110 &#92;to 36,60 &#92;to 24' class='latex' /></p>
<p>Several commenters figured this out as well. Does this always happen? If so, can we prove it?</p>
<p>Let&#8217;s start by thinking about what happens when we do the successive-differencing procedure. If we start with the list <img src='http://s0.wp.com/latex.php?latex=a%2Cb&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b' title='a,b' class='latex' />, then we get <img src='http://s0.wp.com/latex.php?latex=-a+%2B+b&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='-a + b' title='-a + b' class='latex' />. (I want to keep the letters in order, which is why I wrote <img src='http://s0.wp.com/latex.php?latex=-a+%2B+b&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='-a + b' title='-a + b' class='latex' /> instead of <img src='http://s0.wp.com/latex.php?latex=b+-+a&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='b - a' title='b - a' class='latex' />. Instead of subtracting the first value from the second, we can think of it as adding the negation of the first value to the second.) If we start with <img src='http://s0.wp.com/latex.php?latex=a%2Cb%2Cc&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b,c' title='a,b,c' class='latex' />, we get</p>
<p><img src='http://s0.wp.com/latex.php?latex=a%2Cb%2Cc+%5Cto+%28-a%2Bb%29%2C+%28-b%2Bc%29+%5Cto+%28a+-+2b+%2B+c%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b,c &#92;to (-a+b), (-b+c) &#92;to (a - 2b + c)' title='a,b,c &#92;to (-a+b), (-b+c) &#92;to (a - 2b + c)' class='latex' />.</p>
<p>(The negation of <img src='http://s0.wp.com/latex.php?latex=%28-a+%2B+b%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(-a + b)' title='(-a + b)' class='latex' /> is <img src='http://s0.wp.com/latex.php?latex=%28a+-+b%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(a - b)' title='(a - b)' class='latex' />; adding this to <img src='http://s0.wp.com/latex.php?latex=%28-b+%2B+c%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(-b + c)' title='(-b + c)' class='latex' /> yields <img src='http://s0.wp.com/latex.php?latex=%28a+-+2b+%2B+c%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(a - 2b + c)' title='(a - 2b + c)' class='latex' />.) From <img src='http://s0.wp.com/latex.php?latex=a%2Cb%2Cc%2Cd&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b,c,d' title='a,b,c,d' class='latex' /> we get</p>
<p><img src='http://s0.wp.com/latex.php?latex=a%2Cb%2Cc%2Cd+%5Cto+%5C%5C+%28-a%2Bb%29%2C+%28-b%2Bc%29%2C+%28-c%2Bd%29+%5Cto+%5C%5C+%28a+-+2b+%2B+c%29%2C+%28b+-+2c+%2B+d%29+%5Cto+%5C%5C+%28-a+%2B+3b+-+3c+%2B+d%29.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b,c,d &#92;to &#92;&#92; (-a+b), (-b+c), (-c+d) &#92;to &#92;&#92; (a - 2b + c), (b - 2c + d) &#92;to &#92;&#92; (-a + 3b - 3c + d).' title='a,b,c,d &#92;to &#92;&#92; (-a+b), (-b+c), (-c+d) &#92;to &#92;&#92; (a - 2b + c), (b - 2c + d) &#92;to &#92;&#92; (-a + 3b - 3c + d).' class='latex' /></p>
<p>Do you see any patterns yet? Let&#8217;s do one more. From the above calculation we can already see that doing four iterations on <img src='http://s0.wp.com/latex.php?latex=a%2Cb%2Cc%2Cd%2Ce&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b,c,d,e' title='a,b,c,d,e' class='latex' /> will result in <img src='http://s0.wp.com/latex.php?latex=%28-a+%2B+3b+-+3c+%2B+d%29%2C+%28-b+%2B+3c+-+3d+%2B+e%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(-a + 3b - 3c + d), (-b + 3c - 3d + e)' title='(-a + 3b - 3c + d), (-b + 3c - 3d + e)' class='latex' /> (do you see why?). Doing one final iteration gives us</p>
<p><img src='http://s0.wp.com/latex.php?latex=a+-+4b+%2B+6c+-+4d+%2B+e&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a - 4b + 6c - 4d + e' title='a - 4b + 6c - 4d + e' class='latex' />.</p>
<p>Hmm. Let&#8217;s make a table.</p>
<div align="center">
<table style="border:none;width:200px;">
<tr>
<td><img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /></td>
<td>Result</td>
</tr>
<tr>
<td>1</td>
<td><img src='http://s0.wp.com/latex.php?latex=-a+%2B+b&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='-a + b' title='-a + b' class='latex' /></td>
</tr>
<tr>
<td>2</td>
<td><img src='http://s0.wp.com/latex.php?latex=a+-+2b+%2B+c&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a - 2b + c' title='a - 2b + c' class='latex' /></td>
</tr>
<tr>
<td>3</td>
<td><img src='http://s0.wp.com/latex.php?latex=-a+%2B+3b+-+3c+%2B+d&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='-a + 3b - 3c + d' title='-a + 3b - 3c + d' class='latex' /></td>
</tr>
<tr>
<td>4</td>
<td><img src='http://s0.wp.com/latex.php?latex=a+-+4b+%2B+6c+-+4d+%2B+e&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a - 4b + 6c - 4d + e' title='a - 4b + 6c - 4d + e' class='latex' /></td>
</tr>
<tr>
<td>5</td>
<td><img src='http://s0.wp.com/latex.php?latex=-a+%2B+5b+-+10c+%2B+10d+-+5e+%2B+f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='-a + 5b - 10c + 10d - 5e + f' title='-a + 5b - 10c + 10d - 5e + f' class='latex' /></td>
</tr>
</table>
</div>
<p>I included one more row (which you can verify if you like). Now do you see a pattern? The coefficients seem to be taken from <a href="http://mathlesstraveled.com/2007/02/17/binomial-coefficients-and-pascals-triangle/">Pascal&#8217;s triangle</a>, but with alternating signs!</p>
<p>In fact, it&#8217;s actually not too hard to see why this happens. At each step we take two offset copies of the previous row (by &quot;offset&quot; I mean that the letters are shifted by one, like <img src='http://s0.wp.com/latex.php?latex=%28a+-+2b+%2B+c%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(a - 2b + c)' title='(a - 2b + c)' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%28b+-+2c+%2B+d%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(b - 2c + d)' title='(b - 2c + d)' class='latex' />) and add the negation of the first to the second. Since the signs are alternating, we really end up <em>adding</em> absolute values of the coefficients. Probably the best way to really see this is through an example:</p>
<p><div align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Bcccccccccc%7D+-%28+%26+-a+%26+%2B+%26+3b+%26+-+%26+3c+%26+%2B+%26+d+%26+%29+%26+%5C%5C+%26+%26+%26+-b+%26+%2B+%26+3c+%26+-+%26+3d+%26+%2B+%26+e+%5C%5C+%5Chline+%26+a+%26+-+%26+4b+%26+%2B+%26+6c+%26+-+%26+4d+%26+%2B+%26+e+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{cccccccccc} -( &amp; -a &amp; + &amp; 3b &amp; - &amp; 3c &amp; + &amp; d &amp; ) &amp; &#92;&#92; &amp; &amp; &amp; -b &amp; + &amp; 3c &amp; - &amp; 3d &amp; + &amp; e &#92;&#92; &#92;hline &amp; a &amp; - &amp; 4b &amp; + &amp; 6c &amp; - &amp; 4d &amp; + &amp; e &#92;end{array}' title='&#92;begin{array}{cccccccccc} -( &amp; -a &amp; + &amp; 3b &amp; - &amp; 3c &amp; + &amp; d &amp; ) &amp; &#92;&#92; &amp; &amp; &amp; -b &amp; + &amp; 3c &amp; - &amp; 3d &amp; + &amp; e &#92;&#92; &#92;hline &amp; a &amp; - &amp; 4b &amp; + &amp; 6c &amp; - &amp; 4d &amp; + &amp; e &#92;end{array}' class='latex' /></div>
</p>
<p>Notice how we flip all the signs in the first row, so that they match the signs in the second row. But this is exactly how Pascal&#8217;s triangle is generated&#8212;each row is the sum of the previous row with itself, offset by one.</p>
<p>Now, in the real problem, we don&#8217;t start with <img src='http://s0.wp.com/latex.php?latex=a%2Cb%2Cc%2Cd%2C%5Cdots&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a,b,c,d,&#92;dots' title='a,b,c,d,&#92;dots' class='latex' />, but with the <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />th powers of <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n+1' title='n+1' class='latex' /> consecutive integers. Let&#8217;s call the first integer <img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k' title='k' class='latex' />, so the sequence of consecutive integers is <img src='http://s0.wp.com/latex.php?latex=k%2C+k%2B1%2C+k%2B2%2C+%5Cdots%2C+k%2Bn&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k, k+1, k+2, &#92;dots, k+n' title='k, k+1, k+2, &#92;dots, k+n' class='latex' />. Given this, we can now write down an expression for what we end up with after doing the iterated difference procedure:</p>
<p><div align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Csum_%7Bi%3D0%7D%5En+%28-1%29%5E%7Bn-i%7D+%5Cbinom%7Bn%7D%7Bi%7D+%28k%2Bi%29%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle &#92;sum_{i=0}^n (-1)^{n-i} &#92;binom{n}{i} (k+i)^n' title='&#92;displaystyle &#92;sum_{i=0}^n (-1)^{n-i} &#92;binom{n}{i} (k+i)^n' class='latex' /></div>
</p>
<p>Let&#8217;s break this down a bit. We know that we get a sum of <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n+1' title='n+1' class='latex' /> terms; that&#8217;s the <img src='http://s0.wp.com/latex.php?latex=%5Csum_%7Bi%3D0%7D%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sum_{i=0}^n' title='&#92;sum_{i=0}^n' class='latex' /> part (you can <a href="http://mathlesstraveled.com/appendices/sigma-notation/">read more about sigma notation here</a>). We&#8217;ll use <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' /> to index the terms. We also know that the terms alternate sign, so we need to include <img src='http://s0.wp.com/latex.php?latex=%28-1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(-1)' title='(-1)' class='latex' /> raised to some power involving <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' />; the <em>last</em> term is always positive, so we use <img src='http://s0.wp.com/latex.php?latex=%28-1%29%5E%7Bn-i%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(-1)^{n-i}' title='(-1)^{n-i}' class='latex' />, which is equal to <img src='http://s0.wp.com/latex.php?latex=1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1' title='1' class='latex' /> when <img src='http://s0.wp.com/latex.php?latex=i+%3D+n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i = n' title='i = n' class='latex' />. The <a href="http://mathlesstraveled.com/2007/02/14/binomial-coefficients/">binomial coefficient</a> <img src='http://s0.wp.com/latex.php?latex=%5Cbinom+n+i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;binom n i' title='&#92;binom n i' class='latex' /> gives us the <img src='http://s0.wp.com/latex.php?latex=i&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='i' title='i' class='latex' />th entry on the <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />th row of <a href="http://mathlesstraveled.com/2007/02/17/binomial-coefficients-and-pascals-triangle/">Pascal&#8217;s triangle</a>. Finally, of course, <img src='http://s0.wp.com/latex.php?latex=%28k%2Bi%29%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(k+i)^n' title='(k+i)^n' class='latex' /> is the <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />th power of one of the integers we started with.</p>
<p>The claim, therefore, is that</p>
<p><div align="center"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+%5Csum_%7Bi%3D0%7D%5En+%28-1%29%5E%7Bn-i%7D+%5Cbinom+n+i+%28k%2Bi%29%5En+%3D+n%21&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle &#92;sum_{i=0}^n (-1)^{n-i} &#92;binom n i (k+i)^n = n!' title='&#92;displaystyle &#92;sum_{i=0}^n (-1)^{n-i} &#92;binom n i (k+i)^n = n!' class='latex' /></div>
</p>
<p>And I will prove it to you, with pretty pictures, as promised!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1444/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1444&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/02/16/differences-of-powers-of-consecutive-integers-part-ii/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>17&#215;17 4-coloring with no monochromatic rectangles</title>
		<link>http://mathlesstraveled.com/2012/02/09/17x17-4-coloring-with-no-monochromatic-rectangles/</link>
		<comments>http://mathlesstraveled.com/2012/02/09/17x17-4-coloring-with-no-monochromatic-rectangles/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 04:45:29 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[open problems]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[pictures]]></category>
		<category><![CDATA[17x17]]></category>
		<category><![CDATA[four-coloring]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[monochromatic]]></category>
		<category><![CDATA[rectangles]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1486</guid>
		<description><![CDATA[Quick, what&#8217;s special about the following picture? As just announced by Bill Gasarch, this is a grid which has been four-colored (that is, each point in the grid has been assigned one of four colors) in such a way that &#8230; <a href="http://mathlesstraveled.com/2012/02/09/17x17-4-coloring-with-no-monochromatic-rectangles/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1486&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quick, what&#8217;s special about the following picture?</p>
<p><a href="http://mathlesstraveled.files.wordpress.com/2012/02/rect17.png"><img src="http://mathlesstraveled.files.wordpress.com/2012/02/rect17.png?w=640" alt="" title="4-colored 17x17 grid with no monochromatic rectangles"   class="aligncenter size-full wp-image-1487" /></a></p>
<p>As <a href="http://blog.computationalcomplexity.org/2012/02/17x17-problem-solved-also-18x18.html">just announced by Bill Gasarch</a>, this is a <img src='http://s0.wp.com/latex.php?latex=17+%5Ctimes+17&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='17 &#92;times 17' title='17 &#92;times 17' class='latex' /> grid which has been four-colored (that is, each point in the grid has been assigned one of four colors) in such a way that there are no <i>monochromatic rectangles</i>, that is, no four grid points forming the corners of an axis-aligned rectangle are all of the same color.  For example, if we change the top-left grid point to red, we can see several monochromatic rectangles pop up:</p>
<p><a href="http://mathlesstraveled.files.wordpress.com/2012/02/rect17-alter1.png"><img src="http://mathlesstraveled.files.wordpress.com/2012/02/rect17-alter1.png?w=640" alt="" title="Altered four-coloring with monochromatic rectangles highlighted"   class="aligncenter size-full wp-image-1488" /></a></p>
<p>Or here&#8217;s another version where I randomly picked a grid point in the middle, changed its color, and sure enough, more monochromatic rectangles result:</p>
<p><a href="http://mathlesstraveled.files.wordpress.com/2012/02/rect17-alter2.png"><img src="http://mathlesstraveled.files.wordpress.com/2012/02/rect17-alter2.png?w=640" alt="" title="Altered four-coloring with monochromatic rectangles highlighted"   class="aligncenter size-full wp-image-1489" /></a></p>
<p>As you can try verifying for yourself (and as I also verified using a computer program), there are no such monochromatic rectangles in the four-coloring at the top of this post!  (If you want to play with the four-coloring yourself, <a href="http://www.cs.umd.edu/~gasarch/BLOGPAPERS/17.txt">here it is</a> in a simple data format.)</p>
<p>For several years <a href="http://blog.computationalcomplexity.org/2009/11/17x17-challenge-worth-28900-this-is-not.html">no one knew if this was possible</a>, and Bill had offered a prize of $289 (that&#8217;s <img src='http://s0.wp.com/latex.php?latex=%5C%2417%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;$17^2' title='&#92;$17^2' class='latex' />, of course) to anyone who could find such a four-coloring.  The prize will be collected by Bernd Steinbach and Christian Posthoff&#8212;you can find more details in <a href="http://blog.computationalcomplexity.org/2012/02/17x17-problem-solved-also-18x18.html">Bill&#8217;s post</a>.  No one yet knows exactly how they found their four-coloring, but apparently they will be presenting a paper about it in May.  I&#8217;ll try to write more about it then (if I understand it at all)!</p>
<p>If you&#8217;re interested in reading more about the history and math behind this problem (and to get some intuition for why it is difficult), take a look at these posts by Brian Hayes on his blog, bit-player: <a href="http://bit-player.org/2009/the-17x17-challenge">The 17&#215;17 challenge</a> and <a href="http://bit-player.org/2009/17-x-17-a-nonprogress-report">17 x 17: A nonprogress report</a>.  <s>I also remember seeing</s> <a href="http://www.martinschweitzer.com/squaregame.html">Here&#8217;s a fun interactive applet</a> where you can play around with the problem, created by Martin Schweitzer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1486/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1486/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1486/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1486&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/02/09/17x17-4-coloring-with-no-monochromatic-rectangles/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:thumbnail url="http://mathlesstraveled.files.wordpress.com/2012/02/rect17.png?w=150" />
		<media:content url="http://mathlesstraveled.files.wordpress.com/2012/02/rect17.png?w=150" medium="image">
			<media:title type="html">4-colored 17x17 grid with no monochromatic rectangles</media:title>
		</media:content>

		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2012/02/rect17.png" medium="image">
			<media:title type="html">4-colored 17x17 grid with no monochromatic rectangles</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2012/02/rect17-alter1.png" medium="image">
			<media:title type="html">Altered four-coloring with monochromatic rectangles highlighted</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2012/02/rect17-alter2.png" medium="image">
			<media:title type="html">Altered four-coloring with monochromatic rectangles highlighted</media:title>
		</media:content>
	</item>
		<item>
		<title>Book review: Nine Algorithms that Changed the Future</title>
		<link>http://mathlesstraveled.com/2012/02/04/book-review-nine-algorithms-that-changed-the-future/</link>
		<comments>http://mathlesstraveled.com/2012/02/04/book-review-nine-algorithms-that-changed-the-future/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 17:13:00 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[computation]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[John MacCormick]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1370</guid>
		<description><![CDATA[Nine Algorithms that Changed the Future: the Ingenious Ideas that Drive Today&#8217;s Computers, by John MacCormick. Princeton University Press, 2012. I&#8217;m often wary of books written for general audiences on technical topics. It&#8217;s quite difficult to write in a way &#8230; <a href="http://mathlesstraveled.com/2012/02/04/book-review-nine-algorithms-that-changed-the-future/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1370&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/Nine-Algorithms-That-Changed-Future/dp/0691147140"><img src="http://press.princeton.edu/images/k9528.gif" alt="Nine Algorithms that Changed the Future" style="float:right;margin:20px;" width="200" /></a></p>
<p><i>Nine Algorithms that Changed the Future: the Ingenious Ideas that Drive Today&#8217;s Computers</i>, by John MacCormick. Princeton University Press, 2012.</p>
<p>I&#8217;m often wary of books written for general audiences on technical topics.  It&#8217;s quite difficult to write in a way that is both accessible to a wide audience and technically accurate.  Many such books end up sacrificing accuracy in the name of accessibility, trying to convey just the &#8220;intuition&#8221; or &#8220;general sense&#8221; of some topic, but often end up giving people the wrong idea instead.</p>
<p>I was quite happy to find, therefore, that John MacCormick nails it: &#8220;9 Algorithms that Changed the Future&#8221; is technically right on the money, but manages to explain things in ways that are both understandable and fun.  Want to understand how Google ranks search results? Or how Amazon manages to never lose or mess up your order information, even though they get hundreds of thousands of orders each day and (as we all know) networks and hard drives are unreliable?  Ever wonder how you can order something over the internet without your credit card number being stolen?  Or how &#8220;zip&#8221; is able to make your files smaller, seemingly by magic?  Even if you have never wondered about these things, perhaps I have made you wonder about them just now.  And that&#8217;s exactly the point of this book: there are quite a few ingenious algorithmic ideas that most of us rely on <i>every day</i> that we rarely&#8212;or never&#8212;even stop to wonder about.  </p>
<p>For example, I actually learned something new: I knew about public-key cryptography but had never really known much about Diffie-Hellman key exchange, which is what allows your web browser to talk to, say, Amazon&#8217;s servers securely even though they have never communicated before. It&#8217;s like having a secret conversation in code with a pen-pal whom you&#8217;ve never met, even though lots of people are reading your mail.  How can you ever <i>agree</i> on a secret code in the first place without the people reading your mail finding out (and hence being able to read all your subsequent coded messages)?  Sounds impossible, doesn&#8217;t it?  But it turns out that it <i>is</i> possible, with some clever ideas, which MacCormick skillfully explains using a fun metaphor about mixing colors of paint.</p>
<p>Each chapter starts out very simply, gradually building up more complex examples until you reach a full understanding of the algorithm being explained.  Along the way MacCormick introduces the &#8220;tricks&#8221;&#8212;the clever, central ideas&#8212;that make each algorithm work.  The writing is excellent: clear, precise, and fun.  I highly recommend this book to anyone curious about the ingenious mathematical and algorithmic ideas underlying some of today&#8217;s most ubiquitous technology.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1370/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1370/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1370/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1370&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/02/04/book-review-nine-algorithms-that-changed-the-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://press.princeton.edu/images/k9528.gif" medium="image">
			<media:title type="html">Nine Algorithms that Changed the Future</media:title>
		</media:content>
	</item>
		<item>
		<title>Computing with decadic numbers</title>
		<link>http://mathlesstraveled.com/2012/01/30/computing-with-decadic-numbers/</link>
		<comments>http://mathlesstraveled.com/2012/01/30/computing-with-decadic-numbers/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 01:10:20 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[arithmetic]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[decadic]]></category>
		<category><![CDATA[numbers]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1448</guid>
		<description><![CDATA[[This is the ninth, and, I think, final in a series of posts on the decadic numbers (previous posts: A curiosity, An invitation to a funny number system, What does &#34;close to&#34; mean?, The decadic metric, Infinite decadic numbers, More &#8230; <a href="http://mathlesstraveled.com/2012/01/30/computing-with-decadic-numbers/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1448&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>[This is the ninth, and, I think, final in a series of posts on the <i>decadic numbers</i> (previous posts: <a href="http://mathlesstraveled.com/2011/09/14/a-curiosity/" title="A&nbsp;curiosity">A curiosity</a>, <a href="http://mathlesstraveled.com/2011/09/17/an-invitation-to-a-funny-number-system/" title="An invitation to a funny number&nbsp;system">An invitation to a funny number system</a>, <a href="http://mathlesstraveled.com/2011/09/22/what-does-close-to-mean/" title="What does &quot;close to&quot;&nbsp;mean?">What does &quot;close to&quot; mean?</a>, <a href="http://mathlesstraveled.com/2011/09/28/the-decadic-metric/" title="The decadic&nbsp;metric">The decadic metric</a>, <a href="http://mathlesstraveled.com/2011/10/19/infinite-decadic-numbers/" title="Infinite decadic&nbsp;numbers">Infinite decadic numbers</a>, <a href="http://mathlesstraveled.com/2011/10/28/more-fun-with-infinite-decadic-numbers/" title="More fun with infinite decadic numbers">More fun with infinite decadic numbers</a>, <a href="http://mathlesstraveled.com/2012/01/04/a-self-square-number/" title="A self-square number">A self-square number</a>, <a href="http://mathlesstraveled.com/2012/01/10/u-tube/" title="u-tube">u-tube</a>).]</p>
<p>In a <a href="http://mathlesstraveled.com/2012/01/04/a-self-square-number/">previous post</a>, we found a <a href="http://mathlesstraveled.com/2011/10/19/infinite-decadic-numbers/">decadic number</a></p>
<p><img src='http://s0.wp.com/latex.php?latex=u+%3D+%5Cdots+57423423230896109004106619977392256259918212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u = &#92;dots 57423423230896109004106619977392256259918212890625' title='u = &#92;dots 57423423230896109004106619977392256259918212890625' class='latex' /></p>
<p>with the curious property that it is its own square, even though it is obviously not zero or one. We then <a href="http://mathlesstraveled.com/2012/01/10/u-tube/">derived a more efficient algorithm</a> for generating the digits of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />. Here&#8217;s some Haskell code (explained in the <a href="http://mathlesstraveled.com/2012/01/10/u-tube/">previous post</a>) which implements the more efficient algorithm, which I include here just so that this post will be a valid literate Haskell file in its entirety.</p>
<pre><code><span>&gt;</span> <span style="color:green;">{-# LANGUAGE TypeSynonymInstances
&gt;            , FlexibleInstances
&gt;   #-}</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">module</span> <span>Decadic2</span> <span style="color:blue;font-weight:bold;">where</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Control</span><span>.</span><span>Monad</span><span>.</span><span>State</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:green;">-- State for incrementally constructing u_n.</span>
<span>&gt;</span> <span style="color:green;">-- Invariant: curT = 10^n; un^2 = pn*curT + un</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">data</span> <span>UState</span> <span style="color:red;">=</span> <span>UState</span> <span style="color:red;">{</span> <span>pn</span>     <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span>                      <span style="color:red;">,</span> <span>un</span>     <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span>                      <span style="color:red;">,</span> <span>curT</span>   <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span>                      <span style="color:red;">}</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">deriving</span> <span>Show</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:green;">-- u_1 = 5;  5^2 = 25 = 2*10 + 5</span>
<span>&gt;</span> <span>initUState</span> <span style="color:red;">=</span> <span>UState</span> <span class="hs-num">2</span> <span class="hs-num">5</span> <span class="hs-num">10</span>
<span>&gt;</span>
<span>&gt;</span> <span>uStep</span> <span style="color:red;">::</span> <span>State</span> <span>UState</span> <span>Int</span>
<span>&gt;</span> <span>uStep</span> <span style="color:red;">=</span> <span style="color:blue;font-weight:bold;">do</span>
<span>&gt;</span>   <span>u</span> <span style="color:red;">&lt;-</span> <span>gets</span> <span>un</span>
<span>&gt;</span>   <span>p</span> <span style="color:red;">&lt;-</span> <span>gets</span> <span>pn</span>
<span>&gt;</span>   <span>t</span> <span style="color:red;">&lt;-</span> <span>gets</span> <span>curT</span>
<span>&gt;</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">let</span> <span>d</span>   <span style="color:red;">=</span> <span>p</span> <span>`mod`</span> <span class="hs-num">10</span>      <span style="color:green;">-- next digit</span>
<span>&gt;</span>       <span>u'</span>  <span style="color:red;">=</span> <span>d</span> <span>*</span> <span>t</span> <span>+</span> <span>u</span>       <span style="color:green;">-- prepend the next digit to u</span>
<span>&gt;</span>       <span>p'</span>  <span style="color:red;">=</span> <span style="color:red;">(</span><span>p</span> <span>+</span> <span class="hs-num">2</span><span>*</span><span>d</span><span>*</span><span>u</span> <span>+</span> <span>d</span><span>*</span><span>d</span><span>*</span><span>t</span><span style="color:red;">)</span> <span>`div`</span> <span class="hs-num">10</span>   <span style="color:green;">-- see above proof</span>
<span>&gt;</span>
<span>&gt;</span>   <span>put</span> <span style="color:red;">(</span><span>UState</span> <span>p'</span> <span>u'</span> <span style="color:red;">(</span><span class="hs-num">10</span><span>*</span><span>t</span><span style="color:red;">)</span><span style="color:red;">)</span> <span style="color:green;">-- record the new values</span>
<span>&gt;</span>
<span>&gt;</span>   <span>return</span> <span>$</span> <span>fromInteger</span> <span>d</span>    <span style="color:green;">-- return the new digit</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">type</span> <span>Decadic</span> <span style="color:red;">=</span> <span style="color:red;">[</span><span>Int</span><span style="color:red;">]</span>
<span>&gt;</span>
<span>&gt;</span> <span>u</span> <span style="color:red;">::</span> <span>Decadic</span>
<span>&gt;</span> <span>u</span> <span style="color:red;">=</span> <span class="hs-num">5</span> <span>:</span> <span>evalState</span> <span style="color:red;">(</span><span>sequence</span> <span>$</span> <span>repeat</span> <span>uStep</span><span style="color:red;">)</span> <span>initUState</span>
</code></pre>
<p>To round things out, I&#8217;d like to show off some of the cool things we can do with this. First, <a href="http://mathlesstraveled.com/2011/10/28/more-fun-with-infinite-decadic-numbers/">as we know</a>, it&#8217;s possible to do arithmetic with decadic numbers. So let&#8217;s implement it!</p>
<p>Addition of decadic numbers is done just like addition of the usual decimal numbers: we add corresponding places (<em>i.e.</em>, line up the numbers one under the other and then add in columns).</p>
<pre><code><span>&gt;</span> <span>plus</span> <span style="color:red;">::</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>Decadic</span>
</code></pre>
<p>First, we have special cases for zero, represented by the empty list of digits: in those cases we just return the other number unchanged.</p>
<pre><code><span>&gt;</span> <span>plus</span> <span>[]</span> <span>n2</span> <span style="color:red;">=</span> <span>n2</span>
<span>&gt;</span> <span>plus</span> <span>n1</span> <span>[]</span> <span style="color:red;">=</span> <span>n1</span>
</code></pre>
<p>Next, to add a decadic number whose first digit is <code>x</code> to a decadic number whose first digit is <code>y</code>, we just add <code>x</code> and <code>y</code> and then continue adding recursively.</p>
<pre><code><span>&gt;</span> <span>plus</span> <span style="color:red;">(</span><span>x</span><span>:</span><span>xs</span><span style="color:red;">)</span> <span style="color:red;">(</span><span>y</span><span>:</span><span>ys</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span style="color:red;">(</span><span>x</span><span>+</span><span>y</span><span style="color:red;">)</span> <span>:</span> <span>plus</span> <span>xs</span> <span>ys</span>
</code></pre>
<p>Of course, we&#8217;re not done: this doesn&#8217;t do any carrying. Instead of modifying our <code>plus</code> function to do carrying, we just write a function <code>normalize</code> which makes sure every place in a decadic number is between <img src='http://s0.wp.com/latex.php?latex=0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='0' title='0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=9&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='9' title='9' class='latex' />; it will come in handy for more than just addition.</p>
<pre><code><span>&gt;</span> <span>normalize</span> <span style="color:red;">::</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>Decadic</span>
</code></pre>
<p>The <code>normalize</code> function simply calls a recursive helper function <code>normalize'</code> which keeps track of the current &quot;carry&quot;. The starting carry, of course, is zero.</p>
<pre><code><span>&gt;</span> <span>normalize</span> <span style="color:red;">=</span> <span>normalize'</span> <span class="hs-num">0</span>
</code></pre>
<p>To normalize zero (the empty list) when the current carry is zero, just return the empty list.</p>
<pre><code><span>&gt;</span>   <span style="color:blue;font-weight:bold;">where</span> <span>normalize'</span> <span class="hs-num">0</span> <span>[]</span> <span style="color:red;">=</span> <span>[]</span>
</code></pre>
<p>With a nonzero carry and the empty list, we simply extend the list with a special zero digit and continue normalizing.</p>
<pre><code><span>&gt;</span>         <span>normalize'</span> <span>carry</span> <span>[]</span> <span style="color:red;">=</span> <span>normalize'</span> <span>carry</span> <span style="color:red;">[</span><span class="hs-num">0</span><span style="color:red;">]</span>
</code></pre>
<p>In the general case, we add the current carry to the next digit <code>x</code>, and compute the quotient and remainder when dividing this sum by ten. The remainder is the next digit <code>d</code>, and the quotient is the new carry which gets passed along recursively.</p>
<pre><code><span>&gt;</span>         <span>normalize'</span> <span>carry</span> <span style="color:red;">(</span><span>x</span><span>:</span><span>xs</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span>d</span> <span>:</span> <span>normalize'</span> <span>carry'</span> <span>xs</span>
<span>&gt;</span>           <span style="color:blue;font-weight:bold;">where</span> <span style="color:red;">(</span><span>carry'</span><span style="color:red;">,</span> <span>d</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span style="color:red;">(</span><span>carry</span> <span>+</span> <span>x</span><span style="color:red;">)</span> <span>`divMod`</span> <span class="hs-num">10</span>
</code></pre>
<p>And now for multiplication, which is based on the observation that zero times anything is zero, and in the general case</p>
<p><img src='http://s0.wp.com/latex.php?latex=%28a+%2B+10b%29%28c+%2B+10d%29+%3D+ac+%2B+10%28a+%5Ccdot+d+%2B+b+%5Ccdot+%28c+%2B+10d%29%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(a + 10b)(c + 10d) = ac + 10(a &#92;cdot d + b &#92;cdot (c + 10d))' title='(a + 10b)(c + 10d) = ac + 10(a &#92;cdot d + b &#92;cdot (c + 10d))' class='latex' />.</p>
<pre><code><span>&gt;</span> <span>mul</span> <span style="color:red;">::</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>Decadic</span>
<span>&gt;</span> <span>mul</span> <span>[]</span> <span style="color:blue;font-weight:bold;">_</span> <span style="color:red;">=</span> <span>[]</span>
<span>&gt;</span> <span>mul</span> <span style="color:blue;font-weight:bold;">_</span> <span>[]</span> <span style="color:red;">=</span> <span>[]</span>
<span>&gt;</span> <span>mul</span> <span style="color:red;">(</span><span>x</span><span>:</span><span>xs</span><span style="color:red;">)</span> <span style="color:red;">(</span><span>y</span><span>:</span><span>ys</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span>x</span><span>*</span><span>y</span> <span>:</span> <span style="color:red;">(</span><span>map</span> <span style="color:red;">(</span><span>x</span><span>*</span><span style="color:red;">)</span> <span>ys</span> <span>+</span> <span style="color:red;">(</span><span>xs</span> <span>*</span> <span style="color:red;">(</span><span>y</span><span>:</span><span>ys</span><span style="color:red;">)</span><span style="color:red;">)</span><span style="color:red;">)</span>
</code></pre>
<p>Finally, we declare <code>Decadic</code> to be an instance of the <code>Num</code> class, which allows us to use decadic numbers in the same ways that we can use other numeric types:</p>
<pre><code><span>&gt;</span> <span style="color:blue;font-weight:bold;">instance</span> <span>Num</span> <span>Decadic</span> <span style="color:blue;font-weight:bold;">where</span>
</code></pre>
<p>To add or multiply decadic numbers, use the <code>plus</code> and <code>mul</code> functions and then normalize.</p>
<pre><code><span>&gt;</span>   <span>n1</span> <span>+</span> <span>n2</span> <span style="color:red;">=</span> <span>normalize</span> <span style="color:red;">(</span><span>plus</span> <span>n1</span> <span>n2</span><span style="color:red;">)</span>
<span>&gt;</span>   <span>n1</span> <span>*</span> <span>n2</span> <span style="color:red;">=</span> <span>normalize</span> <span style="color:red;">(</span><span>mul</span> <span>n1</span> <span>n2</span><span style="color:red;">)</span>
</code></pre>
<p>To negate a decadic number, subtract the last digit from 10 and the rest of the digits from 9.</p>
<pre><code><span>&gt;</span>   <span>negate</span> <span>[]</span> <span style="color:red;">=</span> <span>[]</span>
<span>&gt;</span>   <span>negate</span> <span style="color:red;">(</span><span>x</span><span>:</span><span>xs</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span>normalize</span> <span>$</span> <span style="color:red;">(</span><span class="hs-num">10</span><span style="color:green;">-</span><span>x</span><span style="color:red;">)</span> <span>:</span> <span>negate'</span> <span>xs</span>
<span>&gt;</span>     <span style="color:blue;font-weight:bold;">where</span> <span>negate'</span> <span>[]</span>     <span style="color:red;">=</span> <span>repeat</span> <span class="hs-num">9</span>
<span>&gt;</span>           <span>negate'</span> <span style="color:red;">(</span><span>x</span><span>:</span><span>xs</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span style="color:red;">(</span><span class="hs-num">9</span><span style="color:green;">-</span><span>x</span><span style="color:red;">)</span> <span>:</span> <span>negate'</span> <span>xs</span>
</code></pre>
<p>Finally, to convert an integer into a decadic number, put the integer into a list of one element and <code>normalize</code>.</p>
<pre><code><span>&gt;</span>   <span>fromInteger</span> <span style="color:red;">=</span> <span>normalize</span> <span>.</span> <span style="color:red;">(</span><span>:</span><span>[]</span><span style="color:red;">)</span> <span>.</span> <span>fromInteger</span>
</code></pre>
<p>So, let&#8217;s try it! We&#8217;ll want a way to display decadic numbers:</p>
<pre><code><span>&gt;</span> <span>showDecadic</span> <span style="color:red;">::</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>IO</span> <span>()</span>
<span>&gt;</span> <span>showDecadic</span> <span>d</span> <span style="color:red;">=</span> <span>putStrLn</span> <span>.</span> <span>dots</span> <span>$</span> <span>digits</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">where</span> <span>d'</span>   <span style="color:red;">=</span> <span>take</span> <span class="hs-num">31</span> <span>d</span>
<span>&gt;</span>         <span>dots</span> <span style="color:red;">|</span> <span>length</span> <span>d'</span> <span>&lt;=</span> <span class="hs-num">30</span> <span style="color:red;">=</span> <span>id</span>
<span>&gt;</span>              <span style="color:red;">|</span> <span>otherwise</span>       <span style="color:red;">=</span> <span style="color:red;">(</span><span style="color:teal;">"..."</span> <span>++</span><span style="color:red;">)</span>
<span>&gt;</span>         <span>digits</span> <span style="color:red;">=</span>  <span>concat</span> <span>.</span> <span>reverse</span> <span>.</span> <span>map</span> <span>show</span> <span>.</span> <span>take</span> <span class="hs-num">30</span> <span>$</span> <span>d'</span>
</code></pre>
<p>Normal decimal integers can also be used as decadic numbers:</p>
<pre><code>*Decadic2&gt; showDecadic 7
7</code></pre>
<p>Here&#8217;s <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />:</p>
<pre><code>*Decadic2&gt; showDecadic u
...106619977392256259918212890625</code></pre>
<p>And here&#8217;s <img src='http://s0.wp.com/latex.php?latex=u%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u^2' title='u^2' class='latex' />; it had better be the same as <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />!</p>
<pre><code>*Decadic2&gt; showDecadic (u^2)
...106619977392256259918212890625</code></pre>
<p>Well, looks like it&#8217;s the same for the first 30 digits at least! We can also compute <img src='http://s0.wp.com/latex.php?latex=1-u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1-u' title='1-u' class='latex' />. Remember, if <img src='http://s0.wp.com/latex.php?latex=u%5E2+%3D+u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u^2 = u' title='u^2 = u' class='latex' /> then <img src='http://s0.wp.com/latex.php?latex=%281-u%29%5E2+%3D+1+-+2u+%2B+u%5E2+%3D+1+-+2u+%2B+u+%3D+1+-+u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(1-u)^2 = 1 - 2u + u^2 = 1 - 2u + u = 1 - u' title='(1-u)^2 = 1 - 2u + u^2 = 1 - 2u + u = 1 - u' class='latex' />, so <img src='http://s0.wp.com/latex.php?latex=1-u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1-u' title='1-u' class='latex' /> should be another self-square number. <a href="http://mathlesstraveled.com/2012/01/04/a-self-square-number/">Remember how we thought</a> there might be a self-square number ending in <img src='http://s0.wp.com/latex.php?latex=6&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='6' title='6' class='latex' />? Well, this is it!</p>
<pre><code>*Decadic2&gt; showDecadic (1-u)
...893380022607743740081787109376
*Decadic2&gt; showDecadic ((1-u)^2)
...893380022607743740081787109376</code></pre>
<p>Finally, we can check that <img src='http://s0.wp.com/latex.php?latex=u+%281+-+u%29+%3D+u+-+u%5E2+%3D+u+-+u+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u (1 - u) = u - u^2 = u - u = 0' title='u (1 - u) = u - u^2 = u - u = 0' class='latex' />:</p>
<pre><code>*Decadic2&gt; showDecadic (u * (1-u))
...000000000000000000000000000000</code></pre>
<p>If you <a href="http://mathlesstraveled.com/2011/09/17/an-invitation-to-a-funny-number-system/">recall</a>, this is in some sense the fundamental reason why the decadic numbers act so funny, because it has <em>zero divisors</em>: pairs of numbers (like <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=1-u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1-u' title='1-u' class='latex' />), neither of which is zero, whose product is nonetheless zero.</p>
<p>Now, if you remember, from even further back, <a href="http://mathlesstraveled.com/2011/09/14/a-curiosity/">what got us into this whole decadic mess</a> in the first place:</p>
<p><img src="http://www.futilitycloset.com/wp-content/uploads/2011/09/2011-09-13-math-notes.png" alt="image" /></p>
<p>In that first post, I said</p>
<blockquote><p>I managed to extend this pattern for a few more digits before I got bored. Does it continue forever or does it eventually stop? Is there any deeper mathematical explanation lurking behind this supposed &#8220;curiosity&#8221;? What&#8217;s so special about <img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+2x%5E2+-+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f(x) = 2x^2 - 1' title='f(x) = 2x^2 - 1' class='latex' />? Do patterns like this exist for other functions?</p></blockquote>
<p>Well, by this point I hope it&#8217;s clear that there is indeed a deeper mathematical explanation lurking! The equation</p>
<p><img src='http://s0.wp.com/latex.php?latex=x+%3D+2x%5E2+-+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x = 2x^2 - 1' title='x = 2x^2 - 1' class='latex' /></p>
<p>admits the solutions <img src='http://s0.wp.com/latex.php?latex=x+%3D+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x = 1' title='x = 1' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=x+%3D+-1%2F2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x = -1/2' title='x = -1/2' class='latex' />, but does it admit any other decadic solutions? Notice that given <img src='http://s0.wp.com/latex.php?latex=%28x+-+a%29%28x+-+b%29+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(x - a)(x - b) = 0' title='(x - a)(x - b) = 0' class='latex' />, which has <img src='http://s0.wp.com/latex.php?latex=x+%3D+a&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x = a' title='x = a' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=x+%3D+b&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x = b' title='x = b' class='latex' /> as solutions, then <img src='http://s0.wp.com/latex.php?latex=u+a+%2B+%281-u%29b&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u a + (1-u)b' title='u a + (1-u)b' class='latex' /> (and <img src='http://s0.wp.com/latex.php?latex=%281-u%29a+%2B+ub&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(1-u)a + ub' title='(1-u)a + ub' class='latex' />) are also solutions:</p>
<p><img src='http://s0.wp.com/latex.php?latex=%28ua+%2B+%281-u%29b+-+a%29%28ua+%2B+%281-u%29b+-+b%29+%3D+%28%28u-1%29a+%2B+%281-u%29b%29%28ua+%2B+ub%29+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(ua + (1-u)b - a)(ua + (1-u)b - b) = ((u-1)a + (1-u)b)(ua + ub) = 0' title='(ua + (1-u)b - a)(ua + (1-u)b - b) = ((u-1)a + (1-u)b)(ua + ub) = 0' class='latex' />.</p>
<p>So in this case we get</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle+u+-+%281-u%29%2F2+%3D+%5Cfrac%7B3u+-+1%7D%7B2%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;displaystyle u - (1-u)/2 = &#92;frac{3u - 1}{2}' title='&#92;displaystyle u - (1-u)/2 = &#92;frac{3u - 1}{2}' class='latex' /></p>
<p>as a solution (the other solution is not a decadic integer).</p>
<p>To implement it, we need a way to halve decadic numbers (I&#8217;ll let you work out what&#8217;s going on here):</p>
<pre><code><span>&gt;</span> <span>halve</span> <span style="color:red;">::</span> <span>Decadic</span> <span style="color:red;">-&gt;</span> <span>Decadic</span>
<span>&gt;</span> <span>halve</span> <span>[]</span> <span style="color:red;">=</span> <span>[]</span>
<span>&gt;</span> <span>halve</span> <span>t</span><span style="color:red;">@</span><span style="color:red;">(</span><span>s</span><span>:</span><span style="color:blue;font-weight:bold;">_</span><span style="color:red;">)</span>
<span>&gt;</span>   <span style="color:red;">|</span> <span>odd</span> <span>s</span>     <span style="color:red;">=</span> <span>error</span> <span style="color:teal;">"foo"</span>
<span>&gt;</span>   <span style="color:red;">|</span> <span>otherwise</span> <span style="color:red;">=</span> <span>halve'</span> <span>t</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">where</span>
<span>&gt;</span>     <span>halve'</span> <span>[]</span> <span style="color:red;">=</span> <span>[]</span>
<span>&gt;</span>     <span>halve'</span> <span style="color:red;">[</span><span>x</span><span style="color:red;">]</span> <span style="color:red;">=</span> <span style="color:red;">[</span><span>x</span> <span>`div`</span> <span class="hs-num">2</span><span style="color:red;">]</span>
<span>&gt;</span>     <span>halve'</span> <span style="color:red;">(</span><span>x</span><span>:</span><span>x'</span><span>:</span><span>xs</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span style="color:red;">(</span><span>x</span> <span>`div`</span> <span class="hs-num">2</span> <span>+</span> <span>adj</span><span style="color:red;">)</span> <span>:</span> <span>halve'</span> <span style="color:red;">(</span><span>x'</span><span>:</span><span>xs</span><span style="color:red;">)</span>
<span>&gt;</span>       <span style="color:blue;font-weight:bold;">where</span> <span>adj</span> <span style="color:red;">|</span> <span>odd</span> <span>x'</span>    <span style="color:red;">=</span> <span class="hs-num">5</span>
<span>&gt;</span>                 <span style="color:red;">|</span> <span>otherwise</span> <span style="color:red;">=</span> <span class="hs-num">0</span>
</code></pre>
<p>And now we can define</p>
<pre><code><span>&gt;</span> <span>q</span> <span style="color:red;">=</span> <span>halve</span> <span style="color:red;">(</span><span class="hs-num">3</span><span>*</span><span>u</span> <span style="color:green;">-</span> <span class="hs-num">1</span><span style="color:red;">)</span>
</code></pre>
<pre><code>*Decadic2&gt; showDecadic q
...159929966088384389877319335937
*Decadic2&gt; showDecadic (2*q^2 - 1)
...159929966088384389877319335937</code></pre>
<p>Woohoo! This clearly shows that the pattern does, in fact, continue forever. It also shows us that <img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+2x%5E2+-+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f(x) = 2x^2 - 1' title='f(x) = 2x^2 - 1' class='latex' /> is not particularly special: any quadratic function that factors as <img src='http://s0.wp.com/latex.php?latex=%28x+-+a%29%28x+-+b%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(x - a)(x - b)' title='(x - a)(x - b)' class='latex' />, at the very least, will lead to a pattern like this, and probably lots of other equations do too.</p>
<p>If you&#8217;re interested in reading more, <a href="http://www.numericana.com/answer/p-adic.htm#decimal">here&#8217;s where I got some of my information</a>. For example, you can read about how there is another number <img src='http://s0.wp.com/latex.php?latex=v+%3D+%5Cdots+04103263499879186432&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v = &#92;dots 04103263499879186432' title='v = &#92;dots 04103263499879186432' class='latex' />, defined by starting with <img src='http://s0.wp.com/latex.php?latex=2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2' title='2' class='latex' /> and iteratively raising to the fifth power (just as we defined <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> by starting with <img src='http://s0.wp.com/latex.php?latex=5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5' title='5' class='latex' /> and successively squaring), such that <img src='http://s0.wp.com/latex.php?latex=v%5E5+%3D+v&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='v^5 = v' title='v^5 = v' class='latex' />. It even seems that the author of that page, Gérard Michon, has recently added a discussion of this very problem, prompted by my blog posts! Isn&#8217;t the internet great?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1448/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1448/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1448/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1448&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/01/30/computing-with-decadic-numbers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://www.futilitycloset.com/wp-content/uploads/2011/09/2011-09-13-math-notes.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Differences of powers of consecutive integers</title>
		<link>http://mathlesstraveled.com/2012/01/29/differences-of-powers-of-consecutive-integers/</link>
		<comments>http://mathlesstraveled.com/2012/01/29/differences-of-powers-of-consecutive-integers/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 21:14:06 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[arithmetic]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[consecutive]]></category>
		<category><![CDATA[difference]]></category>
		<category><![CDATA[integers]]></category>
		<category><![CDATA[powers]]></category>
		<category><![CDATA[surprising]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1439</guid>
		<description><![CDATA[Patrick Vennebush of Math Jokes 4 Mathy Folks recently wrote about the following procedure that yields surprising results. Choose some positive integer . Now, starting with consecutive integers, raise each integer to the th power. Then take pairwise differences by &#8230; <a href="http://mathlesstraveled.com/2012/01/29/differences-of-powers-of-consecutive-integers/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1439&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Patrick Vennebush of Math Jokes 4 Mathy Folks <a href="http://mathjokes4mathyfolks.wordpress.com/2012/01/26/depressing-expressions/">recently wrote about</a> the following procedure that yields surprising results. Choose some positive integer <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />. Now, starting with <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n+1' title='n+1' class='latex' /> consecutive integers, raise each integer to the <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />th power. Then take pairwise differences by subtracting the first number from the second, the second from the third, and so on, resulting in a list of only <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> numbers. Do the same thing again, resulting in <img src='http://s0.wp.com/latex.php?latex=n-1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n-1' title='n-1' class='latex' /> numbers, and repeat until you are left with a single number.</p>
<p>For example, suppose we choose <img src='http://s0.wp.com/latex.php?latex=n%3D4&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n=4' title='n=4' class='latex' />, and start with the five consecutive integers <img src='http://s0.wp.com/latex.php?latex=23%2C+24%2C+25%2C+26%2C+27&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='23, 24, 25, 26, 27' title='23, 24, 25, 26, 27' class='latex' />. We raise them all to the fourth power, giving us</p>
<p><img src='http://s0.wp.com/latex.php?latex=279841%2C331776%2C390625%2C456976%2C531441&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='279841,331776,390625,456976,531441' title='279841,331776,390625,456976,531441' class='latex' /></p>
<p>Now we take pairwise differences: <img src='http://s0.wp.com/latex.php?latex=331776+-+279841+%3D+51935&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='331776 - 279841 = 51935' title='331776 - 279841 = 51935' class='latex' />, then <img src='http://s0.wp.com/latex.php?latex=390625+-+331776+%3D+58849&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='390625 - 331776 = 58849' title='390625 - 331776 = 58849' class='latex' />, and so on, and we get the new list</p>
<p><img src='http://s0.wp.com/latex.php?latex=51935%2C58849%2C66351%2C74465&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='51935,58849,66351,74465' title='51935,58849,66351,74465' class='latex' /></p>
<p>Repeating the difference procedure gives</p>
<p><img src='http://s0.wp.com/latex.php?latex=6914%2C7502%2C8114&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='6914,7502,8114' title='6914,7502,8114' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=588%2C612&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='588,612' title='588,612' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=24&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='24' title='24' class='latex' /></p>
<p>OK, so we get <img src='http://s0.wp.com/latex.php?latex=24&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='24' title='24' class='latex' />. So what?</p>
<p>Well, if you try enough examples, you may notice a surprising pattern. I&#8217;ll let you play with it for a while. Over the course of a few future posts I&#8217;ll explain the pattern and prove that it always holds&#8212;but the proof will be a really cool <em>combinatorial</em> one, with pretty pictures!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1439/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1439/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1439/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1439/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1439/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1439/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1439/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1439&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/01/29/differences-of-powers-of-consecutive-integers/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>u-tube</title>
		<link>http://mathlesstraveled.com/2012/01/10/u-tube/</link>
		<comments>http://mathlesstraveled.com/2012/01/10/u-tube/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 06:15:37 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[computation]]></category>
		<category><![CDATA[convergence]]></category>
		<category><![CDATA[infinity]]></category>
		<category><![CDATA[iteration]]></category>
		<category><![CDATA[modular arithmetic]]></category>
		<category><![CDATA[number theory]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[decadic]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[idempotent]]></category>
		<category><![CDATA[streaming]]></category>
		<category><![CDATA[u]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1425</guid>
		<description><![CDATA[[This is the eighth in a series of posts on the decadic numbers (previous posts: A curiosity, An invitation to a funny number system, What does &#34;close to&#34; mean?, The decadic metric, Infinite decadic numbers, More fun with infinite decadic &#8230; <a href="http://mathlesstraveled.com/2012/01/10/u-tube/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1425&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>[This is the eighth in a series of posts on the <i>decadic numbers</i> (previous posts: <a href="http://mathlesstraveled.com/2011/09/14/a-curiosity/" title="A&nbsp;curiosity">A curiosity</a>, <a href="http://mathlesstraveled.com/2011/09/17/an-invitation-to-a-funny-number-system/" title="An invitation to a funny number&nbsp;system">An invitation to a funny number system</a>, <a href="http://mathlesstraveled.com/2011/09/22/what-does-close-to-mean/" title="What does “close to”&nbsp;mean?">What does &quot;close to&quot; mean?</a>, <a href="http://mathlesstraveled.com/2011/09/28/the-decadic-metric/" title="The decadic&nbsp;metric">The decadic metric</a>, <a href="http://mathlesstraveled.com/2011/10/19/infinite-decadic-numbers/" title="Infinite decadic&nbsp;numbers">Infinite decadic numbers</a>, <a href="http://mathlesstraveled.com/2011/10/28/more-fun-with-infinite-decadic-numbers/" title="More fun with infinite decadic numbers">More fun with infinite decadic numbers</a>, <a href="http://mathlesstraveled.com/2012/01/04/a-self-square-number/" title="A self-square number">A self-square number</a>).]</p>
<p>In my <a href="http://mathlesstraveled.com/2012/01/04/a-self-square-number/" title="A self-square number">previous post</a>, we found a decadic number</p>
<p><img src='http://s0.wp.com/latex.php?latex=u+%3D+%5Cdots+57423423230896109004106619977392256259918212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u = &#92;dots 57423423230896109004106619977392256259918212890625' title='u = &#92;dots 57423423230896109004106619977392256259918212890625' class='latex' /></p>
<p>with the curious property that it is its own square.</p>
<p>We also discovered an algorithm for computing <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />: starting with <img src='http://s0.wp.com/latex.php?latex=u_1+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_1 = 5' title='u_1 = 5' class='latex' />, we square each <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> and take the remainder <img src='http://s0.wp.com/latex.php?latex=%5Cbmod%7B10%5E%7Bn%2B1%7D%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;bmod{10^{n+1}}' title='&#92;bmod{10^{n+1}}' class='latex' /> (that is, we keep only the last <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n+1' title='n+1' class='latex' /> digits) to give us <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}' title='u_{n+1}' class='latex' />. Then <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> is defined as the limit of the <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> as <img src='http://s0.wp.com/latex.php?latex=n+%5Cto+%5Cinfty&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n &#92;to &#92;infty' title='n &#92;to &#92;infty' class='latex' />.</p>
<p>(As an aside, notice why we are allowed to define <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> as a limit: because of the funny <a href="http://mathlesstraveled.com/2011/09/28/the-decadic-metric/" title="The decadic&nbsp;metric">decadic metric</a>, the distance between successive <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> is actually getting smaller by a factor of <img src='http://s0.wp.com/latex.php?latex=1%2F10&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1/10' title='1/10' class='latex' /> each time; they are <i>converging</i> on something, and that something is <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />.)</p>
<p>So,</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D+u_2+%26+%3D+%26+u_1%5E2+%5Cbmod%7B100%7D+%3D+5%5E2+%5Cbmod%7B100%7D+%3D+25+%5C%5C+u_3+%26+%3D+%26+u_2%5E2+%5Cbmod%7B1000%7D+%3D+25%5E2+%5Cbmod%7B1000%7D+%3D+625+%5C%5C+u_4+%26+%3D+%26+u_3%5E2+%5Cbmod%7B10000%7D+%3D+625%5E2+%5Cbmod%7B10000%7D+%3D+390625+%5Cbmod%7B10000%7D+%3D+625+%5C%5C+u_5+%26+%3D+%26+%5Cdots+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl} u_2 &amp; = &amp; u_1^2 &#92;bmod{100} = 5^2 &#92;bmod{100} = 25 &#92;&#92; u_3 &amp; = &amp; u_2^2 &#92;bmod{1000} = 25^2 &#92;bmod{1000} = 625 &#92;&#92; u_4 &amp; = &amp; u_3^2 &#92;bmod{10000} = 625^2 &#92;bmod{10000} = 390625 &#92;bmod{10000} = 625 &#92;&#92; u_5 &amp; = &amp; &#92;dots &#92;end{array}' title='&#92;begin{array}{rcl} u_2 &amp; = &amp; u_1^2 &#92;bmod{100} = 5^2 &#92;bmod{100} = 25 &#92;&#92; u_3 &amp; = &amp; u_2^2 &#92;bmod{1000} = 25^2 &#92;bmod{1000} = 625 &#92;&#92; u_4 &amp; = &amp; u_3^2 &#92;bmod{10000} = 625^2 &#92;bmod{10000} = 390625 &#92;bmod{10000} = 625 &#92;&#92; u_5 &amp; = &amp; &#92;dots &#92;end{array}' class='latex' /></p>
<p>We can pretty easily turn this into a computer program to compute <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> to as many digits as we like. As usual, I&#8217;m using my favorite programming language, <a href="http://www.haskell.org/">Haskell</a>. It doesn&#8217;t matter if you don&#8217;t know Haskell, I&#8217;ll try to explain things well enough that you can still follow along anyway.</p>
<p>First we just need to import something we&#8217;ll need later.</p>
<pre><code><span>&gt;</span> <span style="color:blue;font-weight:bold;">module</span> <span>Decadic</span> <span style="color:blue;font-weight:bold;">where</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Control</span><span>.</span><span>Monad</span><span>.</span><span>State</span>
</code></pre>
<p>Now, we define <code>u1</code> to be 5, and the function <code>nextU</code> takes <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> as input and produces <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D+%3D+u_n%5E2+%5Cbmod%7B10%5E%7Bn%2B1%7D%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1} = u_n^2 &#92;bmod{10^{n+1}}' title='u_{n+1} = u_n^2 &#92;bmod{10^{n+1}}' class='latex' />.</p>
<pre><code><span>&gt;</span> <span>u1</span> <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span> <span>u1</span> <span style="color:red;">=</span> <span class="hs-num">5</span>
<span>&gt;</span>
<span>&gt;</span> <span>nextU</span> <span style="color:red;">::</span> <span>Integer</span> <span style="color:red;">-&gt;</span> <span>Integer</span> <span style="color:red;">-&gt;</span> <span>Integer</span>
<span>&gt;</span> <span>nextU</span> <span>n</span> <span>un</span> <span style="color:red;">=</span> <span style="color:red;">(</span><span>un</span><span>^</span><span class="hs-num">2</span><span style="color:red;">)</span> <span>`mod`</span> <span style="color:red;">(</span><span class="hs-num">10</span><span>^</span><span style="color:red;">(</span><span>n</span><span>+</span><span class="hs-num">1</span><span style="color:red;">)</span><span style="color:red;">)</span>
</code></pre>
<p>Now we can define the (infinite!) list of <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, which we&#8217;ll call <code>us</code>. <code>generateUs</code> takes the current values of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> and generates a list with <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> as its first element, and the remainder of the list computed by a recursive call to <code>generateUs</code> (with <img src='http://s0.wp.com/latex.php?latex=n+%2B+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n + 1' title='n + 1' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}' title='u_{n+1}' class='latex' /> as its inputs). <code>us</code> just gets things started by calling <code>generateUs</code> with <img src='http://s0.wp.com/latex.php?latex=n%3D1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n=1' title='n=1' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_1+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_1 = 5' title='u_1 = 5' class='latex' />.</p>
<pre><code><span>&gt;</span> <span>us</span> <span style="color:red;">::</span> <span style="color:red;">[</span><span>Integer</span><span style="color:red;">]</span>
<span>&gt;</span> <span>us</span> <span style="color:red;">=</span> <span>generateUs</span> <span class="hs-num">1</span> <span>u1</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">where</span> <span>generateUs</span> <span>n</span> <span>un</span> <span style="color:red;">=</span> <span>un</span> <span>:</span> <span>generateUs</span> <span style="color:red;">(</span><span>n</span><span>+</span><span class="hs-num">1</span><span style="color:red;">)</span> <span style="color:red;">(</span><span>nextU</span> <span>n</span> <span>un</span><span style="color:red;">)</span>
</code></pre>
<p>Let&#8217;s see if it works by asking for the first ten elements of the list <code>us</code>:</p>
<pre><code>*Decadic&gt; take 10 us
[5,25,625,625,90625,890625,2890625,12890625,212890625,8212890625]</code></pre>
<p>Seems good!</p>
<p>However, all is not roses. Let&#8217;s think about what our program had to do in order to calculate <img src='http://s0.wp.com/latex.php?latex=u_%7B10%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{10}' title='u_{10}' class='latex' />. Given <img src='http://s0.wp.com/latex.php?latex=u_9+%3D+212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_9 = 212890625' title='u_9 = 212890625' class='latex' />, it first squared it to get <img src='http://s0.wp.com/latex.php?latex=45322418212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='45322418212890625' title='45322418212890625' class='latex' />&#8230; but wait a minute! <img src='http://s0.wp.com/latex.php?latex=45322418212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='45322418212890625' title='45322418212890625' class='latex' /> ends in <img src='http://s0.wp.com/latex.php?latex=212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='212890625' title='212890625' class='latex' />&#8212;of course it does, since that&#8217;s the defining property of the <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />. But that means that <em>half</em> (more or less) of the work needed to square <img src='http://s0.wp.com/latex.php?latex=212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='212890625' title='212890625' class='latex' /> was completely wasted! There&#8217;s no point in computing the last half of <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' />, since we already know it is going to be <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />. We only care about the rest of it.</p>
<p>Realizing that our program is doing too much work is one thing; turning this intuition into actual improvements is quite another! Initially it was far from obvious to me how to avoid the repeated work. But I finally figured it out.</p>
<p>The key is to remember at each step not just <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, but <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' />. However, since we know that <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' /> ends with <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, we can remember <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> along with the <em>prefix</em> (call it <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' />) of <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' /> that comes before the ending <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />. For example, for <img src='http://s0.wp.com/latex.php?latex=n+%3D+9&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n = 9' title='n = 9' class='latex' /> we&#8217;ll remember <img src='http://s0.wp.com/latex.php?latex=p_9+%3D+45322418&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_9 = 45322418' title='p_9 = 45322418' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_9+%3D+212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_9 = 212890625' title='u_9 = 212890625' class='latex' /> (since <img src='http://s0.wp.com/latex.php?latex=u_9%5E2+%3D+45322418212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_9^2 = 45322418212890625' title='u_9^2 = 45322418212890625' class='latex' />). That is, we will always insist that</p>
<p><img src='http://s0.wp.com/latex.php?latex=u_n%5E2+%3D+10%5En+p_n+%2B+u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2 = 10^n p_n + u_n' title='u_n^2 = 10^n p_n + u_n' class='latex' />.</p>
<p>The key question now is: given <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, how do we compute <img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1}' title='p_{n+1}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}' title='u_{n+1}' class='latex' />? Well, computing <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}' title='u_{n+1}' class='latex' /> is easy: it&#8217;s just <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> with an extra digit tacked on, namely, the final digit of <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' />. In particular, we can define <img src='http://s0.wp.com/latex.php?latex=d_%7Bn%2B1%7D+%3D+p_n+%5Cbmod%7B10%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d_{n+1} = p_n &#92;bmod{10}' title='d_{n+1} = p_n &#92;bmod{10}' class='latex' /> to be the last digit of <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' />; then <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D+%3D+d_%7Bn%2B1%7D+10%5En+%2B+u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1} = d_{n+1} 10^n + u_n' title='u_{n+1} = d_{n+1} 10^n + u_n' class='latex' />.</p>
<p>It&#8217;s computing <img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1}' title='p_{n+1}' class='latex' /> which is the tricky part. Since we want to have <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D%5E2+%3D+p_%7Bn%2B1%7D+10%5E%7Bn%2B1%7D+%2B+u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}^2 = p_{n+1} 10^{n+1} + u_{n+1}' title='u_{n+1}^2 = p_{n+1} 10^{n+1} + u_{n+1}' class='latex' />, the idea is to expand out <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}^2' title='u_{n+1}^2' class='latex' />, manipulate it into the desired form, and see what we get for <img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1}' title='p_{n+1}' class='latex' />:</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D+u_%7Bn%2B1%7D%5E2+%26+%3D+%26+%28d_%7Bn%2B1%7D+10%5En+%2B+u_n%29%5E2+%5C%5C+%26+%3D+%26+d_%7Bn%2B1%7D%5E2+10%5E%7B2n%7D+%2B+2d_%7Bn%2B1%7D+10%5En+u_n+%2B+u_n%5E2+%5C%5C+%26+%3D+%26+d_%7Bn%2B1%7D%5E2+10%5E%7B2n%7D+%2B+2d_%7Bn%2B1%7D+10%5En+u_n+%2B+p_n+10%5En+%2B+u_n+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl} u_{n+1}^2 &amp; = &amp; (d_{n+1} 10^n + u_n)^2 &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + u_n^2 &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + p_n 10^n + u_n &#92;end{array}' title='&#92;begin{array}{rcl} u_{n+1}^2 &amp; = &amp; (d_{n+1} 10^n + u_n)^2 &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + u_n^2 &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + p_n 10^n + u_n &#92;end{array}' class='latex' /></p>
<p>Now, note that we can break <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' /> into two parts: the last digit (which we&#8217;re calling <img src='http://s0.wp.com/latex.php?latex=d_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d_{n+1}' title='d_{n+1}' class='latex' />) and the rest. That is,</p>
<p><img src='http://s0.wp.com/latex.php?latex=p_n+%3D+10+%5Clfloor+p_n%2F10+%5Crfloor+%2B+d_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n = 10 &#92;lfloor p_n/10 &#92;rfloor + d_{n+1}' title='p_n = 10 &#92;lfloor p_n/10 &#92;rfloor + d_{n+1}' class='latex' /></p>
<p>where <img src='http://s0.wp.com/latex.php?latex=%5Clfloor+-+%5Crfloor&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;lfloor - &#92;rfloor' title='&#92;lfloor - &#92;rfloor' class='latex' /> denotes rounding down to the nearest integer, so <img src='http://s0.wp.com/latex.php?latex=%5Clfloor+p_n%2F10+%5Crfloor&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;lfloor p_n/10 &#92;rfloor' title='&#92;lfloor p_n/10 &#92;rfloor' class='latex' /> means to divide <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' /> by 10 and throw away the remainder&#8212;that is, <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' /> without its final digit. Continuing,</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D+u_%7Bn%2B1%7D%5E2+%26+%3D+%26+d_%7Bn%2B1%7D%5E2+10%5E%7B2n%7D+%2B+2d_%7Bn%2B1%7D+10%5En+u_n+%2B+p_n+10%5En+%2B+u_n+%5C%5C+%26+%3D+%26+d_%7Bn%2B1%7D%5E2+10%5E%7B2n%7D+%2B+2d_%7Bn%2B1%7D+10%5En+u_n+%2B+%5Clfloor+p_n+%2F+10+%5Crfloor+10%5E%7Bn%2B1%7D+%2B+d_%7Bn%2B1%7D+10%5En+%2B+u_n+%5C%5C+%26+%3D+%26+d_%7Bn%2B1%7D%5E2+10%5E%7B2n%7D+%2B+2d_%7Bn%2B1%7D+10%5En+u_n+%2B+%5Clfloor+p_n+%2F+10+%5Crfloor+10%5E%7Bn%2B1%7D+%2B+u_%7Bn%2B1%7D+%5C%5C+%26+%3D+%26+%28d_%7Bn%2B1%7D%5E2+10%5E%7Bn-1%7D+%2B+2+d_%7Bn%2B1%7D+u_n+%2F+10+%2B+%5Clfloor+p_n+%2F+10+%5Crfloor%29++10%5E%7Bn%2B1%7D+%2B+u_%7Bn%2B1%7D+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl} u_{n+1}^2 &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + p_n 10^n + u_n &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + &#92;lfloor p_n / 10 &#92;rfloor 10^{n+1} + d_{n+1} 10^n + u_n &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + &#92;lfloor p_n / 10 &#92;rfloor 10^{n+1} + u_{n+1} &#92;&#92; &amp; = &amp; (d_{n+1}^2 10^{n-1} + 2 d_{n+1} u_n / 10 + &#92;lfloor p_n / 10 &#92;rfloor)  10^{n+1} + u_{n+1} &#92;end{array}' title='&#92;begin{array}{rcl} u_{n+1}^2 &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + p_n 10^n + u_n &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + &#92;lfloor p_n / 10 &#92;rfloor 10^{n+1} + d_{n+1} 10^n + u_n &#92;&#92; &amp; = &amp; d_{n+1}^2 10^{2n} + 2d_{n+1} 10^n u_n + &#92;lfloor p_n / 10 &#92;rfloor 10^{n+1} + u_{n+1} &#92;&#92; &amp; = &amp; (d_{n+1}^2 10^{n-1} + 2 d_{n+1} u_n / 10 + &#92;lfloor p_n / 10 &#92;rfloor)  10^{n+1} + u_{n+1} &#92;end{array}' class='latex' /></p>
<p>and there we have it! We have expressed <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}^2' title='u_{n+1}^2' class='latex' /> in the form <img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D+10%5E%7Bn%2B1%7D+%2B+u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1} 10^{n+1} + u_{n+1}' title='p_{n+1} 10^{n+1} + u_{n+1}' class='latex' />. In particular,</p>
<p><img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D+%3D+d_%7Bn%2B1%7D%5E2+10%5E%7Bn-1%7D+%2B+2+d_%7Bn%2B1%7D+u_n+%2F+10+%2B+%5Clfloor+p_n+%2F+10+%5Crfloor&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1} = d_{n+1}^2 10^{n-1} + 2 d_{n+1} u_n / 10 + &#92;lfloor p_n / 10 &#92;rfloor' title='p_{n+1} = d_{n+1}^2 10^{n-1} + 2 d_{n+1} u_n / 10 + &#92;lfloor p_n / 10 &#92;rfloor' class='latex' /></p>
<p>Notice that <img src='http://s0.wp.com/latex.php?latex=2+d_%7Bn%2B1%7D+u_n+%2F+10&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2 d_{n+1} u_n / 10' title='2 d_{n+1} u_n / 10' class='latex' /> is actually guaranteed to be an integer, since <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> is divisible by 5&#8212;this is the same phenomenon we ran across in proving that our simple algorithm for computing <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> works correctly. So we can factor out a division by ten (division is generally slow so we&#8217;d rather only do it once):</p>
<p><img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D+%3D+%5Clfloor+%28d_%7Bn%2B1%7D%5E2+10%5En+%2B+2+d_%7Bn%2B1%7D+u_n+%2B+p_n%29+%2F+10+%5Crfloor&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1} = &#92;lfloor (d_{n+1}^2 10^n + 2 d_{n+1} u_n + p_n) / 10 &#92;rfloor' title='p_{n+1} = &#92;lfloor (d_{n+1}^2 10^n + 2 d_{n+1} u_n + p_n) / 10 &#92;rfloor' class='latex' /></p>
<p>And now for some code! As one final optimization, instead of keeping track of <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />, we keep track of <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' />, so we don&#8217;t have to keep recomputing <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' /> every iteration.</p>
<p>First, the data structure we use to keep track of the current values of <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' />:</p>
<pre><code><span>&gt;</span> <span style="color:green;">-- State for incrementally constructing u_n.</span>
<span>&gt;</span> <span style="color:green;">-- Invariant: curT = 10^n; un^2 = pn*curT + un</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">data</span> <span>UState</span> <span style="color:red;">=</span> <span>UState</span> <span style="color:red;">{</span> <span>pn</span>     <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span>                      <span style="color:red;">,</span> <span>un</span>     <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span>                      <span style="color:red;">,</span> <span>curT</span>   <span style="color:red;">::</span> <span>Integer</span>
<span>&gt;</span>                      <span style="color:red;">}</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">deriving</span> <span>Show</span>
</code></pre>
<p>The initial state for <img src='http://s0.wp.com/latex.php?latex=n+%3D+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n = 1' title='n = 1' class='latex' /> has <img src='http://s0.wp.com/latex.php?latex=p_1+%3D+2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_1 = 2' title='p_1 = 2' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=u_1+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_1 = 5' title='u_1 = 5' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=10%5E1+%3D+10&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^1 = 10' title='10^1 = 10' class='latex' />.</p>
<pre><code><span>&gt;</span> <span style="color:green;">-- u_1 = 5;  5^2 = 25 = 2*10 + 5</span>
<span>&gt;</span> <span>initUState</span> <span style="color:red;">=</span> <span>UState</span> <span class="hs-num">2</span> <span class="hs-num">5</span> <span class="hs-num">10</span>
</code></pre>
<p>The <code>uStep</code> function is the heart of the algorithm: it takes the current values of <img src='http://s0.wp.com/latex.php?latex=p_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_n' title='p_n' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' /> and updates them to <img src='http://s0.wp.com/latex.php?latex=p_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='p_{n+1}' title='p_{n+1}' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1}' title='u_{n+1}' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=10%5E%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^{n+1}' title='10^{n+1}' class='latex' />. It also returns <img src='http://s0.wp.com/latex.php?latex=d_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d_{n+1}' title='d_{n+1}' class='latex' /> as its result, which we can use to build up <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> digit-by-digit.</p>
<pre><code><span>&gt;</span> <span>uStep</span> <span style="color:red;">::</span> <span>State</span> <span>UState</span> <span>Int</span>
<span>&gt;</span> <span>uStep</span> <span style="color:red;">=</span> <span style="color:blue;font-weight:bold;">do</span>
<span>&gt;</span>   <span>u</span> <span style="color:red;">&lt;-</span> <span>gets</span> <span>un</span>
<span>&gt;</span>   <span>p</span> <span style="color:red;">&lt;-</span> <span>gets</span> <span>pn</span>
<span>&gt;</span>   <span>t</span> <span style="color:red;">&lt;-</span> <span>gets</span> <span>curT</span>
<span>&gt;</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">let</span> <span>d</span>   <span style="color:red;">=</span> <span>p</span> <span>`mod`</span> <span class="hs-num">10</span>      <span style="color:green;">-- next digit</span>
<span>&gt;</span>       <span>u'</span>  <span style="color:red;">=</span> <span>d</span> <span>*</span> <span>t</span> <span>+</span> <span>u</span>       <span style="color:green;">-- prepend the next digit to u</span>
<span>&gt;</span>       <span>p'</span>  <span style="color:red;">=</span> <span style="color:red;">(</span><span>p</span> <span>+</span> <span class="hs-num">2</span><span>*</span><span>d</span><span>*</span><span>u</span> <span>+</span> <span>d</span><span>*</span><span>d</span><span>*</span><span>t</span><span style="color:red;">)</span> <span>`div`</span> <span class="hs-num">10</span>   <span style="color:green;">-- see above proof</span>
<span>&gt;</span>
<span>&gt;</span>   <span>put</span> <span style="color:red;">(</span><span>UState</span> <span>p'</span> <span>u'</span> <span style="color:red;">(</span><span class="hs-num">10</span><span>*</span><span>t</span><span style="color:red;">)</span><span style="color:red;">)</span> <span style="color:green;">-- record the new values</span>
<span>&gt;</span>
<span>&gt;</span>   <span>return</span> <span>$</span> <span>fromInteger</span> <span>d</span>    <span style="color:green;">-- return the new digit</span>
</code></pre>
<p>So, did we gain anything? As a concrete comparison, let&#8217;s see how long it takes to compute <img src='http://s0.wp.com/latex.php?latex=u_%7B10001%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{10001}' title='u_{10001}' class='latex' />. Using our first, simple code, it takes 7.2 seconds:</p>
<pre><code>*Decadic&gt; :set +s
*Decadic&gt; length . show $ us !! 10000
10001
(7.23 secs, 208746872 bytes)</code></pre>
<p>(I just had it print the <em>number of digits</em> of <img src='http://s0.wp.com/latex.php?latex=u_%7B10001%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{10001}' title='u_{10001}' class='latex' /> to avoid wasting a ton of space printing out the entire number.) And using our new and hopefully improved code?</p>
<pre><code>*Decadic&gt; length . show . un . flip execState initUState
          $ replicateM_ 10000 uStep
10001
(1.55 secs, 225857080 bytes)</code></pre>
<p>Only 1.5 seconds! Nice!</p>
<p>The other nice thing about <code>uStep</code> is that it spits out one digit of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> at a time, which we can use to define <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> as an (infinite) list of digits&#8212;as if the digits were coming one at a time down a &quot;tube&quot;, a <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />-tube, one might say&#8230; get it, a <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />&#8230; tube&#8230; heh&#8230; never mind.</p>
<pre><code><span>&gt;</span> <span style="color:blue;font-weight:bold;">type</span> <span>TenAdic</span> <span style="color:red;">=</span> <span style="color:red;">[</span><span>Int</span><span style="color:red;">]</span>
<span>&gt;</span>
<span>&gt;</span> <span>u</span> <span style="color:red;">::</span> <span>TenAdic</span>
<span>&gt;</span> <span>u</span> <span style="color:red;">=</span> <span class="hs-num">5</span> <span>:</span> <span>evalState</span> <span style="color:red;">(</span><span>sequence</span> <span>$</span> <span>repeat</span> <span>uStep</span><span style="color:red;">)</span> <span>initUState</span>
</code></pre>
<pre><code>*Decadic&gt; reverse $ take 20 u
[9,2,2,5,6,2,5,9,9,1,8,2,1,2,8,9,0,6,2,5]</code></pre>
<p>Nifty! Next time the <em>real</em> fun begins, as I show off some cool things we can do with our shiny new implementation of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1425/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1425&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/01/10/u-tube/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Herbert Wilf: 13 June 1931 &#8211; 7 January 2012</title>
		<link>http://mathlesstraveled.com/2012/01/09/herbert-wilf-13-june-1931-7-january-2012/</link>
		<comments>http://mathlesstraveled.com/2012/01/09/herbert-wilf-13-june-1931-7-january-2012/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 04:34:28 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[people]]></category>
		<category><![CDATA[Herbert Wilf]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1412</guid>
		<description><![CDATA[I was sad to learn that Herbert Wilf died yesterday. Long-time readers of this blog may remember him as one of the discoverers of the Calkin-Wilf tree, which I wrote about in a ten-part series of posts (1, 2, 3, &#8230; <a href="http://mathlesstraveled.com/2012/01/09/herbert-wilf-13-june-1931-7-january-2012/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1412&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was sad to learn that <a href="http://www.math.upenn.edu/~wilf/" title="Herbert Wilf">Herbert Wilf</a> died yesterday.  Long-time readers of this blog may remember him as one of the discoverers of the <i>Calkin-Wilf tree</i>, which I wrote about in a ten-part series of posts (<a href="http://mathlesstraveled.com/2007/12/27/recounting-the-rationals-part-i/" title="Recounting the Rationals, part I">1</a>, <a href="http://mathlesstraveled.com/2008/01/07/recounting-the-rationals-part-ii-fractions-grow-on-trees/" title="Recounting the Rationals, part II (fractions grow on trees!)">2</a>, <a href="http://mathlesstraveled.com/2008/01/24/recounting-the-rationals-part-iii/" title="Recounting the Rationals, part III">3</a>, <a href="http://mathlesstraveled.com/2008/02/06/recounting-the-rationals-part-iv/" title="Recounting the Rationals, part IV">4</a>, <a href="http://mathlesstraveled.com/2008/02/11/recounting-the-rationals-part-ivb-the-euclidean-algorithm/" title="Recounting the Rationals, part IVb: the Euclidean Algorithm">5</a>, <a href="http://mathlesstraveled.com/2008/04/18/challenge-12-sums-of-powers-of-two/" title="Challenge #12: sums of powers of two">6</a>, <a href="http://mathlesstraveled.com/2009/09/19/challenge-12-solution-part-ii/" title="Challenge #12 solution, part II">7</a>, <a href="http://mathlesstraveled.com/2009/09/28/more-hyperbinary-fun/" title="More hyperbinary fun">8</a>, <a href="http://mathlesstraveled.com/2009/10/12/hyperbinary-conjecture-seeking-proof-for-a-good-time-long-walks-on-the-beach/" title="Hyperbinary conjecture seeking proof for a good time, long walks on the beach">9</a>, <a href="http://mathlesstraveled.com/2009/10/18/the-hyperbinary-sequence-and-the-calkin-wilf-tree/" title="The hyperbinary sequence and the Calkin-Wilf tree">10</a>).</p>
<div id="attachment_916" class="wp-caption aligncenter" style="width: 410px"><a href="http://mathlesstraveled.files.wordpress.com/2009/10/cw-small.png"><img src="http://mathlesstraveled.files.wordpress.com/2009/10/cw-small.png?w=640" alt="The Calkin-Wilf Tree" title="cw-small"   class="size-full wp-image-916" /></a><p class="wp-caption-text">The Calkin-Wilf Tree</p></div>
<p>He also wrote <a href="http://www.math.upenn.edu/~wilf/DownldGF.html" title="generatingfunctionology">generatingfunctionology</a>, a textbook about generating functions, a topic near and dear to my heart (which I hope to write about here someday).</p>
<p>Although he was an emeritus professor at the University of Pennsylvania (where I am currently doing my PhD) I sadly never got a chance to meet him.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1412&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/01/09/herbert-wilf-13-june-1931-7-january-2012/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2009/10/cw-small.png" medium="image">
			<media:title type="html">cw-small</media:title>
		</media:content>
	</item>
		<item>
		<title>A self-square number</title>
		<link>http://mathlesstraveled.com/2012/01/04/a-self-square-number/</link>
		<comments>http://mathlesstraveled.com/2012/01/04/a-self-square-number/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 19:45:26 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[arithmetic]]></category>
		<category><![CDATA[infinity]]></category>
		<category><![CDATA[iteration]]></category>
		<category><![CDATA[modular arithmetic]]></category>
		<category><![CDATA[proof]]></category>
		<category><![CDATA[decadic]]></category>
		<category><![CDATA[idempotent]]></category>
		<category><![CDATA[self]]></category>
		<category><![CDATA[square]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1223</guid>
		<description><![CDATA[[This is the seventh in a series of posts on the decadic numbers (previous posts: A curiosity, An invitation to a funny number system, What does "close to" mean?, The decadic metric, Infinite decadic numbers, More fun with infinite decadic &#8230; <a href="http://mathlesstraveled.com/2012/01/04/a-self-square-number/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1223&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>[This is the seventh in a series of posts on the <i>decadic numbers</i> (previous posts:  <a href="http://mathlesstraveled.com/2011/09/14/a-curiosity/" title="A&nbsp;curiosity">A curiosity</a>, <a href="http://mathlesstraveled.com/2011/09/17/an-invitation-to-a-funny-number-system/" title="An invitation to a funny number&nbsp;system">An invitation to a funny number system</a>, <a href="http://mathlesstraveled.com/2011/09/22/what-does-close-to-mean/" title="What does “close to”&nbsp;mean?">What does "close to" mean?</a>, <a href="http://mathlesstraveled.com/2011/09/28/the-decadic-metric/" title="The decadic&nbsp;metric">The decadic metric</a>, <a href="http://mathlesstraveled.com/2011/10/19/infinite-decadic-numbers/" title="Infinite decadic&nbsp;numbers">Infinite decadic numbers</a>, <a href="http://mathlesstraveled.com/2011/10/28/more-fun-with-infinite-decadic-numbers/" title="More fun with infinite decadic numbers">More fun with infinite decadic numbers</a>).  I know it's been a while since I've written on this topic, so if you've been following along, you might want to go back and refresh your memory.]</p>
<p>Finally, as promised, I can show you the strange number <i>u</i> which is its own square (but which <i>isn&#8217;t</i> zero or one!).  Up until now all the decadic numbers we&#8217;ve considered have been equivalent to familiar rational numbers, but zero and one are the only rational numbers which are their own square; clearly <i>u</i> must be something quite different!</p>
<p>Assuming that such a <i>u</i> could exist&#8212;and assuming it&#8217;s a <i>decadic integer</i>, that is, has no digits to the right of the decimal point&#8212;let&#8217;s think for a minute about what <i>u</i> could possibly be.  For example, what could its <i>last digit</i> be?</p>
<p>When we multiply two integers, the last digit of the result depends only on the last digits of the integers being multiplied, since all the other digits contribute some power of 10.  So we can narrow down the possibilities for the last digit of any self-square decadic integer by seeing which digits have squares that end in the same digit:</p>
<div align="center">
<table style="border:none;width:200px;">
<tr>
<td><img src='http://s0.wp.com/latex.php?latex=d_0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d_0' title='d_0' class='latex' /></td>
<td><img src='http://s0.wp.com/latex.php?latex=d_0%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d_0^2' title='d_0^2' class='latex' /></td>
</tr>
<tr style="background-color:#ddddff;">
<td>0</td>
<td>0</td>
</tr>
<tr style="background-color:#ddddff;">
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>4</td>
</tr>
<tr>
<td>3</td>
<td>9</td>
</tr>
<tr>
<td>4</td>
<td>16</td>
</tr>
<tr style="background-color:#ddddff;">
<td>5</td>
<td>25</td>
</tr>
<tr style="background-color:#ddddff;">
<td>6</td>
<td>36</td>
</tr>
<tr>
<td>7</td>
<td>49</td>
</tr>
<tr>
<td>8</td>
<td>64</td>
</tr>
<tr>
<td>9</td>
<td>81</td>
</tr>
</table>
</div>
<p>I&#8217;ve highlighted the digits with the desired property: of course, <img src='http://s0.wp.com/latex.php?latex=0%5E2+%3D+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='0^2 = 0' title='0^2 = 0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=1%5E2+%3D+1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1^2 = 1' title='1^2 = 1' class='latex' />, but also <img src='http://s0.wp.com/latex.php?latex=5%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5^2' title='5^2' class='latex' /> ends in <img src='http://s0.wp.com/latex.php?latex=5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5' title='5' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=6%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='6^2' title='6^2' class='latex' /> ends in <img src='http://s0.wp.com/latex.php?latex=6&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='6' title='6' class='latex' />.  We already know we don&#8217;t want to consider <img src='http://s0.wp.com/latex.php?latex=0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='0' title='0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1' title='1' class='latex' />.  So for now, let&#8217;s suppose that <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> ends with <img src='http://s0.wp.com/latex.php?latex=5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5' title='5' class='latex' />.</p>
<p>What about the last <i>two</i> digits of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />?  Again, the last two digits of <img src='http://s0.wp.com/latex.php?latex=u%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u^2' title='u^2' class='latex' /> depend only on the last two digits of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />. (If this isn&#8217;t obvious to you, you should try a few examples to convince yourself. For example, what is <img src='http://s0.wp.com/latex.php?latex=1234+%5Ccdot+962&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='1234 &#92;cdot 962' title='1234 &#92;cdot 962' class='latex' />? What information did you need to compute the last two digits of the answer?)  So whatever the last two digits are, their square, when considered on their own as a two-digit number, must be some number that ends in the same two digits. Assuming the last digit is <img src='http://s0.wp.com/latex.php?latex=5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5' title='5' class='latex' />, we can turn this requirement into a modular equation which we can use to solve for the second-to-last digit:</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D%2810d_1+%2B+5%29%5E2+%26+%5Cequiv+%26+10d_1+%2B+5+%5Cpmod%7B100%7D+%5C%5C+100d_1%5E2+%2B+100d_1+%2B+25+%26+%5Cequiv+%26+10d_1+%2B+5+%5Cpmod%7B100%7D+%5C%5C+20+%26+%5Cequiv+%26+10d+_1%5Cpmod%7B100%7D+%5C%5C+2+%26+%5Cequiv+%26+d_1+%5Cpmod%7B10%7D+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl}(10d_1 + 5)^2 &amp; &#92;equiv &amp; 10d_1 + 5 &#92;pmod{100} &#92;&#92; 100d_1^2 + 100d_1 + 25 &amp; &#92;equiv &amp; 10d_1 + 5 &#92;pmod{100} &#92;&#92; 20 &amp; &#92;equiv &amp; 10d _1&#92;pmod{100} &#92;&#92; 2 &amp; &#92;equiv &amp; d_1 &#92;pmod{10} &#92;end{array}' title='&#92;begin{array}{rcl}(10d_1 + 5)^2 &amp; &#92;equiv &amp; 10d_1 + 5 &#92;pmod{100} &#92;&#92; 100d_1^2 + 100d_1 + 25 &amp; &#92;equiv &amp; 10d_1 + 5 &#92;pmod{100} &#92;&#92; 20 &amp; &#92;equiv &amp; 10d _1&#92;pmod{100} &#92;&#92; 2 &amp; &#92;equiv &amp; d_1 &#92;pmod{10} &#92;end{array}' class='latex' /></p>
<p>Sure enough, <img src='http://s0.wp.com/latex.php?latex=25%5E2+%3D+625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='25^2 = 625' title='25^2 = 625' class='latex' /> which ends with <img src='http://s0.wp.com/latex.php?latex=25&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='25' title='25' class='latex' />.</p>
<p>Can we take this further? What about the last three digits?</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D%28100d_2+%2B+25%29%5E2+%26+%5Cequiv+%26+100d_2+%2B+25+%5Cpmod%7B1000%7D+%5C%5C+10000d_2%5E2+%2B+5000d_2+%2B+625+%26+%5Cequiv+%26+100d_2+%2B+25+%5Cpmod%7B1000%7D+%5C%5C+600+%26+%5Cequiv+%26+100d_2+%5Cpmod%7B1000%7D+%5C%5C+6+%26%5Cequiv+%26+d_2+%5Cpmod%7B10%7D+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl}(100d_2 + 25)^2 &amp; &#92;equiv &amp; 100d_2 + 25 &#92;pmod{1000} &#92;&#92; 10000d_2^2 + 5000d_2 + 625 &amp; &#92;equiv &amp; 100d_2 + 25 &#92;pmod{1000} &#92;&#92; 600 &amp; &#92;equiv &amp; 100d_2 &#92;pmod{1000} &#92;&#92; 6 &amp;&#92;equiv &amp; d_2 &#92;pmod{10} &#92;end{array}' title='&#92;begin{array}{rcl}(100d_2 + 25)^2 &amp; &#92;equiv &amp; 100d_2 + 25 &#92;pmod{1000} &#92;&#92; 10000d_2^2 + 5000d_2 + 625 &amp; &#92;equiv &amp; 100d_2 + 25 &#92;pmod{1000} &#92;&#92; 600 &amp; &#92;equiv &amp; 100d_2 &#92;pmod{1000} &#92;&#92; 6 &amp;&#92;equiv &amp; d_2 &#92;pmod{10} &#92;end{array}' class='latex' /></p>
<p>Check: <img src='http://s0.wp.com/latex.php?latex=625%5E2+%3D+390625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='625^2 = 390625' title='625^2 = 390625' class='latex' />, which indeed ends with <img src='http://s0.wp.com/latex.php?latex=625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='625' title='625' class='latex' />.  Continuing in a similar fashion (I&#8217;ll let you work out the details on your own), we find that the fourth digit must be <img src='http://s0.wp.com/latex.php?latex=0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='0' title='0' class='latex' />, and the fifth digit must be <img src='http://s0.wp.com/latex.php?latex=9&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='9' title='9' class='latex' />.</p>
<p>Are you seeing a pattern?  Let&#8217;s make a table of the results so far:</p>
<div align="center">
<table style="border:none;width:200px;">
<tr>
<td><img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /></td>
<td><img src='http://s0.wp.com/latex.php?latex=u+%5Cbmod%7B10%5En%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u &#92;bmod{10^n}' title='u &#92;bmod{10^n}' class='latex' /></td>
<td><img src='http://s0.wp.com/latex.php?latex=%28u+%5Cbmod%7B10%5En%7D%29%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(u &#92;bmod{10^n})^2' title='(u &#92;bmod{10^n})^2' class='latex' /></td>
</tr>
<tr>
<td>1</td>
<td>5</td>
<td><b>25</b></td>
</tr>
<tr>
<td>2</td>
<td>25</td>
<td><b>625</b></td>
</tr>
<tr>
<td>3</td>
<td>625</td>
<td>39<b>0625</b></td>
</tr>
<tr>
<td>4</td>
<td>0625</td>
<td>3<b>90625</b></td>
</tr>
<tr>
<td>5</td>
<td>90625</td>
<td>8212890625</td>
</tr>
</table>
</div>
<p>Why did I put some numbers in bold?  Well, hopefully you&#8217;ve noticed by now that each number in the left-hand column always seems to be a suffix of the square of the previous number.  So perhaps the next digit will be 8?  Sure enough, <img src='http://s0.wp.com/latex.php?latex=890625%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='890625^2' title='890625^2' class='latex' /> ends in <img src='http://s0.wp.com/latex.php?latex=890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='890625' title='890625' class='latex' />.</p>
<p>Will this always work?  Yes, in fact, it will, and here&#8217;s why.  Let&#8217;s let <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> denote the last <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> digits of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> (so <img src='http://s0.wp.com/latex.php?latex=u_1+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_1 = 5' title='u_1 = 5' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=u_2+%3D+25&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_2 = 25' title='u_2 = 25' class='latex' />, and so on).  Once we have found <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />, we can set up a modular equation to find the next digit (this is just a generalization of what we did earlier):</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D%2810%5En+d_n+%2B+u_n%29%5E2+%26+%5Cequiv+%26+10%5En+d_n+%2B+u_n+%5Cpmod%7B10%5E%7Bn%2B1%7D%7D+%5C%5C++10%5E%7B2n%7D+d_n%5E2+%2B+2+%5Ccdot+10%5En+d_n+u_n+%2B+u_n%5E2+%26+%5Cequiv+%26+10%5En+d_n+%2B+u_n+%5Cpmod%7B10%5E%7Bn%2B1%7D%7D+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl}(10^n d_n + u_n)^2 &amp; &#92;equiv &amp; 10^n d_n + u_n &#92;pmod{10^{n+1}} &#92;&#92;  10^{2n} d_n^2 + 2 &#92;cdot 10^n d_n u_n + u_n^2 &amp; &#92;equiv &amp; 10^n d_n + u_n &#92;pmod{10^{n+1}} &#92;end{array}' title='&#92;begin{array}{rcl}(10^n d_n + u_n)^2 &amp; &#92;equiv &amp; 10^n d_n + u_n &#92;pmod{10^{n+1}} &#92;&#92;  10^{2n} d_n^2 + 2 &#92;cdot 10^n d_n u_n + u_n^2 &amp; &#92;equiv &amp; 10^n d_n + u_n &#92;pmod{10^{n+1}} &#92;end{array}' class='latex' /></p>
<p>Now, <img src='http://s0.wp.com/latex.php?latex=10%5E%7B2n%7D+d_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^{2n} d_n^2' title='10^{2n} d_n^2' class='latex' /> is clearly divisible by <img src='http://s0.wp.com/latex.php?latex=10%5E%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^{n+1}' title='10^{n+1}' class='latex' /> so that term goes away.  But what about <img src='http://s0.wp.com/latex.php?latex=2+%5Ccdot+10%5En+d_n+u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2 &#92;cdot 10^n d_n u_n' title='2 &#92;cdot 10^n d_n u_n' class='latex' />?  It seems that we only know it is divisible by <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' />, not necessarily by <img src='http://s0.wp.com/latex.php?latex=10%5E%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^{n+1}' title='10^{n+1}' class='latex' />.  Ah, but wait!  We know that <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> ends with <img src='http://s0.wp.com/latex.php?latex=5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5' title='5' class='latex' />, and hence is divisible by <img src='http://s0.wp.com/latex.php?latex=5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='5' title='5' class='latex' />; combining this with the <img src='http://s0.wp.com/latex.php?latex=2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2' title='2' class='latex' /> gives us another factor of <img src='http://s0.wp.com/latex.php?latex=10&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10' title='10' class='latex' />!  So this term goes away too, and we are left with</p>
<p><img src='http://s0.wp.com/latex.php?latex=u_n%5E2+%5Cequiv+10%5En+d_n+%2B+u_n+%5Cpmod%7B10%5E%7Bn%2B1%7D%7D.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2 &#92;equiv 10^n d_n + u_n &#92;pmod{10^{n+1}}.' title='u_n^2 &#92;equiv 10^n d_n + u_n &#92;pmod{10^{n+1}}.' class='latex' /></p>
<p>Now, <img src='http://s0.wp.com/latex.php?latex=u_n%5E2+%5Cequiv+u_n+%5Cpmod%7B10%5En%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2 &#92;equiv u_n &#92;pmod{10^n}' title='u_n^2 &#92;equiv u_n &#92;pmod{10^n}' class='latex' /> (by definition), so subtracting <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> from both sides leaves a multiple of <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' /> in the place of <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' /> (namely, <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' /> with the rightmost <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> digits set to zero).  But we can also get rid of all the digits to the left of the <img src='http://s0.wp.com/latex.php?latex=%28n%2B1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(n+1)' title='(n+1)' class='latex' />st because we are working mod <img src='http://s0.wp.com/latex.php?latex=10%5E%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^{n+1}' title='10^{n+1}' class='latex' />. Dividing by <img src='http://s0.wp.com/latex.php?latex=10%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='10^n' title='10^n' class='latex' /> we find that <img src='http://s0.wp.com/latex.php?latex=d_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='d_n' title='d_n' class='latex' /> must be equal to that <img src='http://s0.wp.com/latex.php?latex=%28n%2B1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(n+1)' title='(n+1)' class='latex' />st digit of <img src='http://s0.wp.com/latex.php?latex=u_n%5E2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n^2' title='u_n^2' class='latex' />.</p>
<p>So here&#8217;s the procedure: starting with <img src='http://s0.wp.com/latex.php?latex=u_1+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_1 = 5' title='u_1 = 5' class='latex' />, define</p>
<p><img src='http://s0.wp.com/latex.php?latex=u_%7Bn%2B1%7D+%3D+u_n%5E2+%5Cbmod%7B10%5E%7Bn%2B1%7D%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_{n+1} = u_n^2 &#92;bmod{10^{n+1}}' title='u_{n+1} = u_n^2 &#92;bmod{10^{n+1}}' class='latex' /></p>
<p>That is, square the current number of length <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' /> and take the last <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n+1' title='n+1' class='latex' /> digits to get the next number.  The above proof shows that</p>
<ul>
<li>At every step we will have a number <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> whose square ends with the digits of <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' />;</li>
<li>this procedure will always work; and</li>
<li>this procedure gives the <i>unique</i> sequence of <img src='http://s0.wp.com/latex.php?latex=u_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_n' title='u_n' class='latex' /> with this property when starting with <img src='http://s0.wp.com/latex.php?latex=u_1+%3D+5&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u_1 = 5' title='u_1 = 5' class='latex' />!</li>
</ul>
<p>So we have</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cbegin%7Barray%7D%7Brcl%7D+u_1+%26+%3D+%26+5+%5C%5C+u_2+%26+%3D+%26+25+%5C%5C+u_3+%26+%3D+%26+625+%5Cend%7Barray%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;begin{array}{rcl} u_1 &amp; = &amp; 5 &#92;&#92; u_2 &amp; = &amp; 25 &#92;&#92; u_3 &amp; = &amp; 625 &#92;end{array}' title='&#92;begin{array}{rcl} u_1 &amp; = &amp; 5 &#92;&#92; u_2 &amp; = &amp; 25 &#92;&#92; u_3 &amp; = &amp; 625 &#92;end{array}' class='latex' /></p>
<p>and so on.</p>
<p>So what is <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />? It is simply the <i>limit</i> of carrying out this procedure to infinity!</p>
<p><img src='http://s0.wp.com/latex.php?latex=u+%3D+%5Cdots+57423423230896109004106619977392256259918212890625&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u = &#92;dots 57423423230896109004106619977392256259918212890625' title='u = &#92;dots 57423423230896109004106619977392256259918212890625' class='latex' /></p>
<p>We know that any suffix of <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' />, when squared, yields something ending with itself.  So it makes sense (although it takes a bit of imagination!) that squaring <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> itself yields <img src='http://s0.wp.com/latex.php?latex=u&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='u' title='u' class='latex' /> again.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1223&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2012/01/04/a-self-square-number/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Four-figure offer</title>
		<link>http://mathlesstraveled.com/2011/12/01/four-figure-offer/</link>
		<comments>http://mathlesstraveled.com/2011/12/01/four-figure-offer/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 16:56:08 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[humor]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[four figure]]></category>
		<category><![CDATA[offer]]></category>

		<guid isPermaLink="false">http://mathlesstraveled.com/?p=1360</guid>
		<description><![CDATA[This just arrived in my inbox: My name is Becky Raymond, I&#8217;m a Domain Brokerage Consultant working on behalf of the owner of traveled.com to sell this premium asset. While searching online I came across your domain mathlesstraveled.com; since both &#8230; <a href="http://mathlesstraveled.com/2011/12/01/four-figure-offer/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1360&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This just arrived in my inbox:</p>
<blockquote><p>
My name is Becky Raymond, I&#8217;m a Domain Brokerage Consultant working on behalf of the owner of traveled.com to sell this premium asset.</p>
<p>While searching online I came across your domain mathlesstraveled.com; since both domains have listings under a related keyword I thought perhaps your company may be interested in acquiring traveled.com? If this domain is of interest to you, please submit an offer in the four figure range and above to qualify as a potential buyer.
</p></blockquote>
<p>Sure thing, Becky! Here is my four-figure offer:</p>
<div id="attachment_1332" class="wp-caption aligncenter" style="width: 410px"><a href="http://mathlesstraveled.files.wordpress.com/2009/09/hypbin1000.png"><img src="http://mathlesstraveled.files.wordpress.com/2009/09/hypbin1000.png?w=640" alt="" title="hypbin1000"   class="size-full wp-image-1332" /></a><p class="wp-caption-text">Fig. 1. A graph of the first 1000 hyperbinary numbers.</p></div>
<div id="attachment_1112" class="wp-caption aligncenter" style="width: 410px"><a href="http://mathlesstraveled.files.wordpress.com/2011/09/hasse5.png"><img src="http://mathlesstraveled.files.wordpress.com/2011/09/hasse5.png?w=640" alt="" title="Hasse5"   class="size-full wp-image-1112" /></a><p class="wp-caption-text">Fig 2. Hasse diagram for the subsets of a five-element set.</p></div>
<div id="attachment_969" class="wp-caption aligncenter" style="width: 410px"><a href="http://mathlesstraveled.files.wordpress.com/2011/04/law4.png"><img src="http://mathlesstraveled.files.wordpress.com/2011/04/law4.png?w=640" alt="" title="law4"   class="size-full wp-image-969" /></a><p class="wp-caption-text">Fig. 3: Proof that <img src='http://s0.wp.com/latex.php?latex=T_n+T_k+%2B+T_%7Bn-1%7D+T_%7Bk-1%7D+%3D+T_%7Bnk%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='T_n T_k + T_{n-1} T_{k-1} = T_{nk}' title='T_n T_k + T_{n-1} T_{k-1} = T_{nk}' class='latex' />.</p></div>
<div id="attachment_909" class="wp-caption aligncenter" style="width: 410px"><a href="http://mathlesstraveled.files.wordpress.com/2009/11/bracelets15.png"><img src="http://mathlesstraveled.files.wordpress.com/2009/11/bracelets15.png?w=276&#038;h=300" alt="" title="bracelets15" width="276" height="300" class="size-medium wp-image-909" /></a><p class="wp-caption-text">Fig. 4: Complete set of 15-bracelets.</p></div>
<p>I hope you will agree that this is a very fine set of figures.  I could probably add a couple more figures to my offer if that becomes necessary.</p>
<p>I look forward to being the proud owner of traveled.com, the place to go for all your mathematical travel needs!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mathlesstraveled.wordpress.com/1360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mathlesstraveled.wordpress.com/1360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mathlesstraveled.wordpress.com/1360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mathlesstraveled.wordpress.com/1360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mathlesstraveled.wordpress.com/1360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mathlesstraveled.wordpress.com/1360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mathlesstraveled.wordpress.com/1360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mathlesstraveled.wordpress.com/1360/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mathlesstraveled.com&amp;blog=21246689&amp;post=1360&amp;subd=mathlesstraveled&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mathlesstraveled.com/2011/12/01/four-figure-offer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2009/09/hypbin1000.png" medium="image">
			<media:title type="html">hypbin1000</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2011/09/hasse5.png" medium="image">
			<media:title type="html">Hasse5</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2011/04/law4.png" medium="image">
			<media:title type="html">law4</media:title>
		</media:content>

		<media:content url="http://mathlesstraveled.files.wordpress.com/2009/11/bracelets15.png?w=276" medium="image">
			<media:title type="html">bracelets15</media:title>
		</media:content>
	</item>
	</channel>
</rss>
