<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://scrollingtext.org">
<channel>
 <title>ScrollingText</title>
 <link>http://scrollingtext.org</link>
 <description />
 <language>en</language>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Scrollingtext" /><feedburner:info uri="scrollingtext" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
 <title>Project Euler: Problem 13</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/rixIgvj3Hok/project-euler-problem-13</link>
 <description>&lt;p&gt;Problem thirteen from Project Euler is one of those problems that's so simple, I don't understand why it's in the double digits section. The problem reads: “Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.”&lt;br /&gt;
It then proceeds to list 100 long numbers. I'm not going to paste them here because they are in the code solutions below and I don't want to clog up the &lt;a href="http://lolcats.icanhascheezburger.com/2011/04/05/funny-pictures-the-internet-is-a-series-of-tubes/"&gt;“tubez”&lt;/a&gt; with more redundant information than I'm about to.&lt;/p&gt;
&lt;p&gt;Enough of my jibber-jabber.  Here is my Haskell solution first (trying to change things up here):&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;module&lt;/span&gt; Main &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:print"&gt;&lt;span style="font-weight: bold;"&gt;print&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take"&gt;&lt;span style="font-weight: bold;"&gt;take&lt;/span&gt;&lt;/a&gt; &lt;span style="color: red;"&gt;10&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:show"&gt;&lt;span style="font-weight: bold;"&gt;show&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"&gt;&lt;span style="font-weight: bold;"&gt;sum&lt;/span&gt;&lt;/a&gt; big&lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt;number&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; big&lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt;number &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt; &lt;span style="color: red;"&gt;37107287533902102798797998220837590246510135740250&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;46376937677490009712648124896970078050417018260538&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;74324986199524741059474233309513058123726617309629&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;91942213363574161572522430563301811072406154908250&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;23067588207539346171171980310421047513778063246676&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;89261670696623633820136378418383684178734361726757&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;28112879812849979408065481931592621691275889832738&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;44274228917432520321923589422876796487670272189318&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;47451445736001306439091167216856844588711603153276&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;70386486105843025439939619828917593665686757934951&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;62176457141856560629502157223196586755079324193331&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;64906352462741904929101432445813822663347944758178&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;92575867718337217661963751590579239728245598838407&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;58203565325359399008402633568948830189458628227828&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;80181199384826282014278194139940567587151170094390&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;35398664372827112653829987240784473053190104293586&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;86515506006295864861532075273371959191420517255829&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;71693888707715466499115593487603532921714970056938&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;54370070576826684624621495650076471787294438377604&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;53282654108756828443191190634694037855217779295145&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;36123272525000296071075082563815656710885258350721&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;45876576172410976447339110607218265236877223636045&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;17423706905851860660448207621209813287860733969412&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;81142660418086830619328460811191061556940512689692&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;51934325451728388641918047049293215058642563049483&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;62467221648435076201727918039944693004732956340691&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;15732444386908125794514089057706229429197107928209&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;55037687525678773091862540744969844508330393682126&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;18336384825330154686196124348767681297534375946515&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;80386287592878490201521685554828717201219257766954&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;78182833757993103614740356856449095527097864797581&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;16726320100436897842553539920931837441497806860984&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;48403098129077791799088218795327364475675590848030&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;87086987551392711854517078544161852424320693150332&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;59959406895756536782107074926966537676326235447210&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;69793950679652694742597709739166693763042633987085&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;41052684708299085211399427365734116182760315001271&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;65378607361501080857009149939512557028198746004375&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;35829035317434717326932123578154982629742552737307&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;94953759765105305946966067683156574377167401875275&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;88902802571733229619176668713819931811048770190271&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;25267680276078003013678680992525463401061632866526&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;36270218540497705585629946580636237993140746255962&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;24074486908231174977792365466257246923322810917141&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;91430288197103288597806669760892938638285025333403&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;34413065578016127815921815005561868836468420090470&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;23053081172816430487623791969842487255036638784583&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;11487696932154902810424020138335124462181441773470&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;63783299490636259666498587618221225225512486764533&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;67720186971698544312419572409913959008952310058822&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;95548255300263520781532296796249481641953868218774&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;76085327132285723110424803456124867697064507995236&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;37774242535411291684276865538926205024910326572967&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;23701913275725675285653248258265463092207058596522&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;29798860272258331913126375147341994889534765745501&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;18495701454879288984856827726077713721403798879715&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;38298203783031473527721580348144513491373226651381&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;34829543829199918180278916522431027392251122869539&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;40957953066405232632538044100059654939159879593635&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;29746152185502371307642255121183693803580388584903&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;41698116222072977186158236678424689157993532961922&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;62467957194401269043877107275048102390895523597457&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;23189706772547915061505504953922979530901129967519&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;86188088225875314529584099251203829009407770775672&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;11306739708304724483816533873502340845647058077308&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;82959174767140363198008187129011875491310547126581&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;97623331044818386269515456334926366572897563400500&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;42846280183517070527831839425882145521227251250327&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;55121603546981200581762165212827652751691296897789&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;32238195734329339946437501907836945765883352399886&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;75506164965184775180738168837861091527357929701337&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;62177842752192623401942399639168044983993173312731&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;32924185707147349566916674687634660915035914677504&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;99518671430235219628894890102423325116913619626622&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;73267460800591547471830798392868535206946944540724&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;76841822524674417161514036427982273348055556214818&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;97142617910342598647204516893989422179826088076852&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;87783646182799346313767754307809363333018982642090&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;10848802521674670883215120185883543223812876952786&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;71329612474782464538636993009049310363619763878039&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;62184073572399794223406235393808339651327408011116&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;66627891981488087797941876876144230030984490851411&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;60661826293682836764744779239180335110989069790714&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;85786944089552990653640447425576083659976645795096&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;66024396409905389607120198219976047599490197230297&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;64913982680032973156037120041377903785566085089252&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;16730939319872750275468906903707539413042652315011&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;94809377245048795150954100921645863754710598436791&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;78639167021187492431995700641917969777599028300699&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;15368713711936614952811305876380278410754449733078&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;40789923115535562561142322423255033685442488917353&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;44889911501440648020369068063960672322193204149535&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;41503128880339536053299340368006977710650566631954&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;81234880673210146739058568557934581403627822703280&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;82616570773948327592232845941706525094512325230608&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;22918802058777319719839450180888072429661980811197&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;77158542502016545090413245809786882778948721859617&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;72107838435069186155435662884062257473692284509516&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;20849603980134001723930671666823555245252804609722&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;53503534226472524250874054075591789781264330331690&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;followed by my Python solution:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #808080; font-style: italic;"&gt;#!/usr/bin/python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #483d8b;"&gt;code solution for project euler's problem #13 in python.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;from&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;__future__&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; print_function&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; print_10&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;number&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #008000;"&gt;str&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;number&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;:&lt;span style="color: #ff4500;"&gt;10&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; __name__ &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    big_number &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;37107287533902102798797998220837590246510135740250&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;46376937677490009712648124896970078050417018260538&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;74324986199524741059474233309513058123726617309629&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;91942213363574161572522430563301811072406154908250&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;23067588207539346171171980310421047513778063246676&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;89261670696623633820136378418383684178734361726757&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;28112879812849979408065481931592621691275889832738&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;44274228917432520321923589422876796487670272189318&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;47451445736001306439091167216856844588711603153276&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;70386486105843025439939619828917593665686757934951&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;62176457141856560629502157223196586755079324193331&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;64906352462741904929101432445813822663347944758178&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;92575867718337217661963751590579239728245598838407&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;58203565325359399008402633568948830189458628227828&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;80181199384826282014278194139940567587151170094390&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;35398664372827112653829987240784473053190104293586&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;86515506006295864861532075273371959191420517255829&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;71693888707715466499115593487603532921714970056938&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;54370070576826684624621495650076471787294438377604&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;53282654108756828443191190634694037855217779295145&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;36123272525000296071075082563815656710885258350721&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;45876576172410976447339110607218265236877223636045&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;17423706905851860660448207621209813287860733969412&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;81142660418086830619328460811191061556940512689692&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;51934325451728388641918047049293215058642563049483&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;62467221648435076201727918039944693004732956340691&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;15732444386908125794514089057706229429197107928209&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;55037687525678773091862540744969844508330393682126&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;18336384825330154686196124348767681297534375946515&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;80386287592878490201521685554828717201219257766954&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;78182833757993103614740356856449095527097864797581&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;16726320100436897842553539920931837441497806860984&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;48403098129077791799088218795327364475675590848030&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;87086987551392711854517078544161852424320693150332&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;59959406895756536782107074926966537676326235447210&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;69793950679652694742597709739166693763042633987085&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;41052684708299085211399427365734116182760315001271&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;65378607361501080857009149939512557028198746004375&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;35829035317434717326932123578154982629742552737307&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;94953759765105305946966067683156574377167401875275&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;88902802571733229619176668713819931811048770190271&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;25267680276078003013678680992525463401061632866526&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;36270218540497705585629946580636237993140746255962&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;24074486908231174977792365466257246923322810917141&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;91430288197103288597806669760892938638285025333403&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;34413065578016127815921815005561868836468420090470&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;23053081172816430487623791969842487255036638784583&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;11487696932154902810424020138335124462181441773470&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;63783299490636259666498587618221225225512486764533&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;67720186971698544312419572409913959008952310058822&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;95548255300263520781532296796249481641953868218774&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;76085327132285723110424803456124867697064507995236&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;37774242535411291684276865538926205024910326572967&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;23701913275725675285653248258265463092207058596522&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;29798860272258331913126375147341994889534765745501&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;18495701454879288984856827726077713721403798879715&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;38298203783031473527721580348144513491373226651381&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;34829543829199918180278916522431027392251122869539&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;40957953066405232632538044100059654939159879593635&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;29746152185502371307642255121183693803580388584903&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;41698116222072977186158236678424689157993532961922&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;62467957194401269043877107275048102390895523597457&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;23189706772547915061505504953922979530901129967519&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;86188088225875314529584099251203829009407770775672&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;11306739708304724483816533873502340845647058077308&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;82959174767140363198008187129011875491310547126581&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;97623331044818386269515456334926366572897563400500&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;42846280183517070527831839425882145521227251250327&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;55121603546981200581762165212827652751691296897789&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;32238195734329339946437501907836945765883352399886&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;75506164965184775180738168837861091527357929701337&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;62177842752192623401942399639168044983993173312731&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;32924185707147349566916674687634660915035914677504&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;99518671430235219628894890102423325116913619626622&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;73267460800591547471830798392868535206946944540724&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;76841822524674417161514036427982273348055556214818&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;97142617910342598647204516893989422179826088076852&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;87783646182799346313767754307809363333018982642090&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;10848802521674670883215120185883543223812876952786&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;71329612474782464538636993009049310363619763878039&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;62184073572399794223406235393808339651327408011116&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;66627891981488087797941876876144230030984490851411&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;60661826293682836764744779239180335110989069790714&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;85786944089552990653640447425576083659976645795096&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;66024396409905389607120198219976047599490197230297&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;64913982680032973156037120041377903785566085089252&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;16730939319872750275468906903707539413042652315011&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;94809377245048795150954100921645863754710598436791&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;78639167021187492431995700641917969777599028300699&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;15368713711936614952811305876380278410754449733078&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;40789923115535562561142322423255033685442488917353&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;44889911501440648020369068063960672322193204149535&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;41503128880339536053299340368006977710650566631954&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;81234880673210146739058568557934581403627822703280&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;82616570773948327592232845941706525094512325230608&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;22918802058777319719839450180888072429661980811197&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;77158542502016545090413245809786882778948721859617&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;72107838435069186155435662884062257473692284509516&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;20849603980134001723930671666823555245252804609722&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                   &lt;span style="color: #ff4500;"&gt;53503534226472524250874054075591789781264330331690&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    print_10&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #008000;"&gt;sum&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;big_number&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;and to continue adding in the spice, I have included a solution in Scala:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="scala geshifilter-scala" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;import&lt;/span&gt;&lt;/a&gt; BigInt.&lt;span style="color: #000080;"&gt;_&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;object&lt;/span&gt;&lt;/a&gt; problem&lt;span style="color: #000080;"&gt;_&lt;/span&gt;13 &lt;span style="color: #F78811;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;def&lt;/span&gt;&lt;/a&gt; main &lt;span style="color: #F78811;"&gt;&amp;#40;&lt;/span&gt;args &lt;span style="color: #000080;"&gt;:&lt;/span&gt; Array&lt;span style="color: #F78811;"&gt;&amp;#91;&lt;/span&gt;String&lt;span style="color: #F78811;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #F78811;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #F78811;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;val&lt;/span&gt;&lt;/a&gt; big&lt;span style="color: #000080;"&gt;_&lt;/span&gt;number &lt;span style="color: #000080;"&gt;=&lt;/span&gt; List&lt;span style="color: #F78811;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #6666FF;"&gt;&amp;quot;37107287533902102798797998220837590246510135740250&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;46376937677490009712648124896970078050417018260538&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;74324986199524741059474233309513058123726617309629&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;91942213363574161572522430563301811072406154908250&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;23067588207539346171171980310421047513778063246676&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;89261670696623633820136378418383684178734361726757&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;28112879812849979408065481931592621691275889832738&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;44274228917432520321923589422876796487670272189318&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;47451445736001306439091167216856844588711603153276&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;70386486105843025439939619828917593665686757934951&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;62176457141856560629502157223196586755079324193331&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;64906352462741904929101432445813822663347944758178&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;92575867718337217661963751590579239728245598838407&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;58203565325359399008402633568948830189458628227828&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;80181199384826282014278194139940567587151170094390&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;35398664372827112653829987240784473053190104293586&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;86515506006295864861532075273371959191420517255829&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;71693888707715466499115593487603532921714970056938&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;54370070576826684624621495650076471787294438377604&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;53282654108756828443191190634694037855217779295145&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;36123272525000296071075082563815656710885258350721&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;45876576172410976447339110607218265236877223636045&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;17423706905851860660448207621209813287860733969412&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;81142660418086830619328460811191061556940512689692&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;51934325451728388641918047049293215058642563049483&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;62467221648435076201727918039944693004732956340691&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;15732444386908125794514089057706229429197107928209&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;55037687525678773091862540744969844508330393682126&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;18336384825330154686196124348767681297534375946515&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;80386287592878490201521685554828717201219257766954&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;78182833757993103614740356856449095527097864797581&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;16726320100436897842553539920931837441497806860984&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;48403098129077791799088218795327364475675590848030&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;87086987551392711854517078544161852424320693150332&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;59959406895756536782107074926966537676326235447210&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;69793950679652694742597709739166693763042633987085&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;41052684708299085211399427365734116182760315001271&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;65378607361501080857009149939512557028198746004375&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;35829035317434717326932123578154982629742552737307&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;94953759765105305946966067683156574377167401875275&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;88902802571733229619176668713819931811048770190271&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;25267680276078003013678680992525463401061632866526&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;36270218540497705585629946580636237993140746255962&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;24074486908231174977792365466257246923322810917141&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;91430288197103288597806669760892938638285025333403&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;34413065578016127815921815005561868836468420090470&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;23053081172816430487623791969842487255036638784583&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;11487696932154902810424020138335124462181441773470&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;63783299490636259666498587618221225225512486764533&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;67720186971698544312419572409913959008952310058822&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;95548255300263520781532296796249481641953868218774&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;76085327132285723110424803456124867697064507995236&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;37774242535411291684276865538926205024910326572967&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;23701913275725675285653248258265463092207058596522&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;29798860272258331913126375147341994889534765745501&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;18495701454879288984856827726077713721403798879715&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;38298203783031473527721580348144513491373226651381&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;34829543829199918180278916522431027392251122869539&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;40957953066405232632538044100059654939159879593635&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;29746152185502371307642255121183693803580388584903&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;41698116222072977186158236678424689157993532961922&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;62467957194401269043877107275048102390895523597457&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;23189706772547915061505504953922979530901129967519&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;86188088225875314529584099251203829009407770775672&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;11306739708304724483816533873502340845647058077308&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;82959174767140363198008187129011875491310547126581&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;97623331044818386269515456334926366572897563400500&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;42846280183517070527831839425882145521227251250327&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;55121603546981200581762165212827652751691296897789&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;32238195734329339946437501907836945765883352399886&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;75506164965184775180738168837861091527357929701337&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;62177842752192623401942399639168044983993173312731&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;32924185707147349566916674687634660915035914677504&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;99518671430235219628894890102423325116913619626622&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;73267460800591547471830798392868535206946944540724&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;76841822524674417161514036427982273348055556214818&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;97142617910342598647204516893989422179826088076852&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;87783646182799346313767754307809363333018982642090&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;10848802521674670883215120185883543223812876952786&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;71329612474782464538636993009049310363619763878039&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;62184073572399794223406235393808339651327408011116&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;66627891981488087797941876876144230030984490851411&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;60661826293682836764744779239180335110989069790714&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;85786944089552990653640447425576083659976645795096&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;66024396409905389607120198219976047599490197230297&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;64913982680032973156037120041377903785566085089252&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;16730939319872750275468906903707539413042652315011&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;94809377245048795150954100921645863754710598436791&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;78639167021187492431995700641917969777599028300699&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;15368713711936614952811305876380278410754449733078&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;40789923115535562561142322423255033685442488917353&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;44889911501440648020369068063960672322193204149535&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;41503128880339536053299340368006977710650566631954&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;81234880673210146739058568557934581403627822703280&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;82616570773948327592232845941706525094512325230608&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;22918802058777319719839450180888072429661980811197&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;77158542502016545090413245809786882778948721859617&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;72107838435069186155435662884062257473692284509516&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;20849603980134001723930671666823555245252804609722&amp;quot;&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #6666FF;"&gt;&amp;quot;53503534226472524250874054075591789781264330331690&amp;quot;&lt;/span&gt;&lt;span style="color: #F78811;"&gt;&amp;#41;&lt;/span&gt; map &lt;span style="color: #F78811;"&gt;&amp;#123;&lt;/span&gt;BigInt&lt;span style="color: #F78811;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000080;"&gt;_&lt;/span&gt;&lt;span style="color: #F78811;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #F78811;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;val&lt;/span&gt;&lt;/a&gt; sums &lt;span style="color: #000080;"&gt;=&lt;/span&gt; big&lt;span style="color: #000080;"&gt;_&lt;/span&gt;number sum&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;val&lt;/span&gt;&lt;/a&gt; su &lt;span style="color: #000080;"&gt;=&lt;/span&gt; sums toString&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;a href="http://scala-lang.org"&gt;&lt;span style="color: #0000ff; font-weight: bold;"&gt;val&lt;/span&gt;&lt;/a&gt; su10 &lt;span style="color: #000080;"&gt;=&lt;/span&gt; su take &lt;span style="color: #F78811;"&gt;10&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        println&lt;span style="color: #F78811;"&gt;&amp;#40;&lt;/span&gt;su10&lt;span style="color: #F78811;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #F78811;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #F78811;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Some of you may be wondering, “Why a Scala solution?”  To which I respond, “Why not?”  Because that's a little short, I'll add that it has something to do with Scala starting to gain traction in the industry and me seeing if I would like to get paid to program in it.&lt;/p&gt;
&lt;p&gt;The solution, in all three languages, is pretty simple. The recipe essentially says, “Put all numbers into a list.  Get the sum of that list, turn that number into a string, and get the first 10 characters of that string.”&lt;/p&gt;
&lt;p&gt;Times:&lt;br /&gt;
Haskell (compiled)   : real	0m0.004s&lt;br /&gt;
Haskell (runghc)     : real	0m0.314s&lt;br /&gt;
Python               : real	0m0.059s&lt;br /&gt;
Scala   (compiled)   : real	0m0.757s&lt;/p&gt;
&lt;p&gt;For the most part it's pretty standard in these tests to see performance times such that Haskell (compiled) &lt; Python &lt; Haskell (runghc). Java and Perl usually fall somewhere between the Haskell (compiled) and Python, in that order. To see Scala be 2x slower than Haskell (runghc) was a shocker.  The only thing that makes sense to me for the slowdown is having to use the BigInt library. That is probably the biggest thing I took away from these time tests - if I want to do REALLY large number crunching and performance DOES matter, JVM-based languages might not be the best option. &lt;/p&gt;
&lt;p&gt;A few thoughts on Scala:&lt;br /&gt;
If I haven't stated it already in this blog, I should now give the disclaimer that I'm not a Java fan.  I know it still has its loyal followers, but I'm not one of them.  Moving on.  This was my first time working with Scala, and I'd like to finally welcome Java to the 21st century.  While doing some research on the Scala language itself I read that “the industry” was moving to replace Java with Scala.  I welcome that change.  Does that mean I “like” Scala?  The honest answer is, to butcher the quote the appliances from the Flintstones, “Eh, it's a language.” Scala is definitely an improvement over Java – not really that hard to do in my opinion – but, the language still feels unpolished.  One quick way to kill the interpreter in Scala is to type “Int” then hit the enter key.  Instead of error-ing out, the interpreter does a great job of interpreting a crash test car hitting a cement wall (I had to restart the whole thing.)  When I tried the same “technique” in the Python interpreter, I got &lt;type 'int'&gt; as a response and for Haskell's interpreter I received “Not in scope: data constructor `Int'”.  I also found Scala's function composition to be a little lacking when compared to Haskell.  I wasn't able to cleanly change the BigInt data type to String, and then only print out ten characters without requiring three separate val's.  Yes, I could have used one var instead, but that's beside the point. I will admit it could be my inexperience with the language showing, so if anyone knows a smoother way to do this in Scala please share it in the comments.&lt;/p&gt;
&lt;p&gt;All that being said, I do like the way Scala is trying to handle the reducing of Java's dot notation, and I think it's starting to make strides in the right direction in other areas.  I'm open to working with Scala more, and look forward to seeing how it evolves over the next few years.  &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=rixIgvj3Hok:x79nWfdzsvA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=rixIgvj3Hok:x79nWfdzsvA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=rixIgvj3Hok:x79nWfdzsvA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=rixIgvj3Hok:x79nWfdzsvA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=rixIgvj3Hok:x79nWfdzsvA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=rixIgvj3Hok:x79nWfdzsvA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=rixIgvj3Hok:x79nWfdzsvA:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/rixIgvj3Hok" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/project-euler-problem-13#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/haskell">Haskell</category>
 <category domain="http://scrollingtext.org/category/catagories/project-euler">Project Euler</category>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <category domain="http://scrollingtext.org/category/catagories/scala">Scala</category>
 <pubDate>Tue, 22 May 2012 16:48:04 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">84 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/project-euler-problem-13</feedburner:origLink></item>
<item>
 <title>Apache Log IP Counting</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/j9LxYKBKQxI/apache-log-ip-counting</link>
 <description>&lt;p&gt;It all started with a simple question: “Which single IP shows up the most in an apache log file?”  To which I ultimately came up with an answer using a string of Bash commands:&lt;/p&gt;
&lt;p&gt;&lt;span class="geshifilter"&gt;&lt;code class="bash geshifilter-bash"&gt;&amp;nbsp;&lt;span style="color: #c20cb9; font-weight: bold;"&gt;less&lt;/span&gt; apache_log &lt;span style="color: #000000; font-weight: bold;"&gt;|&lt;/span&gt; &lt;span style="color: #c20cb9; font-weight: bold;"&gt;cut&lt;/span&gt; &lt;span style="color: #660033;"&gt;-d&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;'-'&lt;/span&gt; &lt;span style="color: #660033;"&gt;-f&lt;/span&gt; &lt;span style="color: #000000;"&gt;1&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;|&lt;/span&gt; &lt;span style="color: #c20cb9; font-weight: bold;"&gt;sort&lt;/span&gt; &lt;span style="color: #660033;"&gt;-r&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;|&lt;/span&gt; &lt;span style="color: #c20cb9; font-weight: bold;"&gt;uniq&lt;/span&gt; &lt;span style="color: #660033;"&gt;-c&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This produced some text displaying how many times various IP addresses made requests from an apache web server.  After seeing the results and thinking for a moment, I remembered that there is a “new” data type – as of Python 2.7 and new to me at least – called &lt;a href="http://docs.python.org/library/collections.html?highlight=counter#collections.Counter"&gt;“Counter”&lt;/a&gt; within the collections module in the standard library that would allow me to recreate this in Python.  So I quickly whipped up the code below:&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #808080; font-style: italic;"&gt;#!/usr/bin/env python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;from&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;sys&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; argv&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;from&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;collections&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; Counter&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; __name__ &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;with&lt;/span&gt; &lt;span style="color: #008000;"&gt;open&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;argv&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;as&lt;/span&gt; f:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        c &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; Counter&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;i.&lt;span style="color: black;"&gt;partition&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;-&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; i &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; f&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; k&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;v &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; c.&lt;span style="color: black;"&gt;most_common&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;'{:&amp;gt;4} {}'&lt;/span&gt;.&lt;span style="color: black;"&gt;format&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;v&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;k&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;VIOLA!  I get the same results as if I'd done it in Bash. Of course, like the madman I am, I wasn't happy to just stop at Python; I had to write this up in Haskell too.  So I said “damn the torpedoes,” fired up my favorite text editor, and started to hack and slash my way toward a third version.  After much documentation reading, internet searching, and trial and error I can proudly proclaim, “MISSION ACCOMPLISHED”:&lt;/p&gt;
&lt;p&gt;&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;module&lt;/span&gt; Main &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; System&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Environment &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;getArgs&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;qualified&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt; T &lt;span style="color: #06c; font-weight: bold;"&gt;hiding&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"&gt;&lt;span style="font-weight: bold;"&gt;head&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zip"&gt;&lt;span style="font-weight: bold;"&gt;zip&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;qualified&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt; TI &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:readFile"&gt;&lt;span style="font-weight: bold;"&gt;readFile&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Map &lt;span style="color: #06c; font-weight: bold;"&gt;hiding&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;type&lt;/span&gt; Counter &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;mapUnpack &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; Counter &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;mapUnpack &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:show"&gt;&lt;span style="font-weight: bold;"&gt;show&lt;/span&gt;&lt;/a&gt; v &lt;span style="color: #339933; font-weight: bold;"&gt;++&lt;/span&gt; &lt;span style="background-color: #3cb371;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;++&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;unpack k&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sortMapByValue &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; Map T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;Counter&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sortMapByValue &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; rqsort &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; toList&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #5d478b; font-style: italic;"&gt;-- copied &amp;amp; modified by LYHGG in the recusion chapter&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #5d478b; font-style: italic;"&gt;-- doing in reverse order as to better suit the output&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;rqsort &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;Counter&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;Counter&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;rqsort &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;rqsort &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;:xs&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; smallerSorted &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; rqsort &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k'&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v'&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;|&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k'&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v'&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; xs&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; v' &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;=&lt;/span&gt; v&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        biggerSorted  &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; rqsort &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k'&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v'&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;|&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k'&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v'&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; xs&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; v' &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt; v&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;in&lt;/span&gt; biggerSorted &lt;span style="color: #339933; font-weight: bold;"&gt;++&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;k&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;v&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;++&lt;/span&gt; smallerSorted&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    results &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; getArgs &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;gt;&amp;gt;=&lt;/span&gt; TI&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:readFile"&gt;&lt;span style="font-weight: bold;"&gt;readFile&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"&gt;&lt;span style="font-weight: bold;"&gt;head&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; results' &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;\x &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;replace space nothing &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"&gt;&lt;span style="font-weight: bold;"&gt;head&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;splitOn dash x&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:lines"&gt;&lt;span style="font-weight: bold;"&gt;lines&lt;/span&gt;&lt;/a&gt; results&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; results'' &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; fromListWith &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;+&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:zip"&gt;&lt;span style="font-weight: bold;"&gt;zip&lt;/span&gt;&lt;/a&gt; results' &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:repeat"&gt;&lt;span style="font-weight: bold;"&gt;repeat&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: red;"&gt;1&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:mapM_"&gt;&lt;span style="font-weight: bold;"&gt;mapM_&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:print"&gt;&lt;span style="font-weight: bold;"&gt;print&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; mapUnpack&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; sortMapByValue results''&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; dash    &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;pack &lt;span style="background-color: #3cb371;"&gt;&amp;quot;-&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;          space   &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;pack &lt;span style="background-color: #3cb371;"&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;          nothing &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;pack &lt;span style="background-color: #3cb371;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The Haskell implementation took me longer than I expected as there were a couple of challenges to figure out:&lt;br /&gt;
    1) Learning the Data.Map datatype and figuring out how to build that datatype from a list of IP addresses.&lt;br /&gt;
    2) Sorting the Map by value and not by key.&lt;br /&gt;
    3) Unpacking the Map to be printed. &lt;/p&gt;
&lt;p&gt;The first problem was solved by a lucky internet search that showed me an example of how to use the &lt;a href=" http://www.haskell.org/ghc/docs/latest/html/libraries/containers/Data-Map.html#v:fromListWith"&gt;'fromListWith'&lt;/a&gt; function.  This function performed the heavy lifting of sorting and counting the IP addresses in the log file.  For the sorting by value instead of by key problem I was able to construct my own solution by tweaking the quicksort example from &lt;i&gt;&lt;a href="http://learnyouahaskell.com/recursion"&gt;Learn You a Haskell&lt;/a&gt;&lt;/i&gt;.  The changes I made expanded the tuple, allowing it to compare values and sort them in descending order.  For the text holding and manipulation involved in Map unpacking, I've been told by other Haskellers that &lt;a href="http://hackage.haskell.org/packages/archive/text/0.11.2.0/doc/html/Data-Text.html"&gt;Data.Text&lt;/a&gt; is “the way to go” (as the default String implementation is a little slow and lacking features).  While Data.Text did provide me an easy way to split the string and grab the IP addresses, it also required translating the IP addresses back into a String data type before Haskell would print it.  Thus my need for a specific function to create a string based on each item in the Map.  In the grand scheme of things having to write the mapUnpack function wasn't horrible...it was just one more hoop that I had to jump through before I could call this project complete.  After these modifications I was able to put this program together without TOO much hassle, and in the end got the exact same results as both the Bash string and the Python program.&lt;/p&gt;
&lt;p&gt;Would I recommend writing these scripts for work instead of using the string of Bash commands?  No, especially if you're asked this question in a high-stress situation.  However, these little personal challenges were a great way to expand my programming skills, particularly in learning about new libraries like the collections module in Python and the Data.Map module in Haskell.  Having this random new knowledge might not seem worthwhile upfront, but might come in handy in the future if I ever encounter a problem that simple strings of Bash commands can't handle.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=j9LxYKBKQxI:v0Kia7b4-y0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=j9LxYKBKQxI:v0Kia7b4-y0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=j9LxYKBKQxI:v0Kia7b4-y0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=j9LxYKBKQxI:v0Kia7b4-y0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=j9LxYKBKQxI:v0Kia7b4-y0:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=j9LxYKBKQxI:v0Kia7b4-y0:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=j9LxYKBKQxI:v0Kia7b4-y0:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/j9LxYKBKQxI" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/apache-log-ip-counting#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/bash">Bash</category>
 <category domain="http://scrollingtext.org/category/catagories/haskell">Haskell</category>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <pubDate>Tue, 08 May 2012 15:55:38 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">83 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/apache-log-ip-counting</feedburner:origLink></item>
<item>
 <title>Connect 4</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/NZ1rJgzqhio/connect-4</link>
 <description>&lt;p&gt;A couple of weeks ago I was lucky enough to have my employer send me to PyCon.  If you weren't at PyCon you missed out on a lot of things...like the invading squirrel hordes.  Thankfully, all of the talks are viewable &lt;a href="http://pyvideo.org/category/17/pycon-us-2012"&gt;here&lt;/a&gt;.  But PyCon is not the focus of this post, just a starting point. At PyCon, in the vendor area, there was the Thumbtack booth.  The guys at this book weren't doing the “normal” conference thing (passing out schwag to every being, living or dead, that passed them); they actually made people work for their swag.  Thumbtack had a programming challenge that you had to submit a solution to before they would give you either a large shot glass or a glass beer stein.&lt;br /&gt;
The challenge was to accept a list of lists from standard input, and parse it looking for a winner in a game of Connect 4.  I believe this could be a great interview question, and will be using it for the upcoming interviews where I work.  One of the reasons for this is that it's deceptively difficult.  While we as humans have been conditioned to recognize patterns since birth, computers need to be taught every step from the beginning.  How do I go about teaching something that I don't remember learning?  But enough of my babbling - let's look at my solution:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #808080; font-style: italic;"&gt;#!/usr/bin/env python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;from&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;__future__&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; print_function&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;sys&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; char&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; prev_row&lt;span style="color: #66cc66;"&gt;=&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; prev_col&lt;span style="color: #66cc66;"&gt;=&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; count&lt;span style="color: #66cc66;"&gt;=&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; direction&lt;span style="color: #66cc66;"&gt;=&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    direction_dict &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;: &lt;span style="color: #008000;"&gt;None&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;2&lt;/span&gt;: &lt;span style="color: #008000;"&gt;None&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;3&lt;/span&gt;: &lt;span style="color: #008000;"&gt;None&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;4&lt;/span&gt;: &lt;span style="color: #ff7700;font-weight:bold;"&gt;lambda&lt;/span&gt;: char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; char&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; count + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;4&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;5&lt;/span&gt;: &lt;span style="color: #008000;"&gt;None&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;6&lt;/span&gt;: &lt;span style="color: #ff7700;font-weight:bold;"&gt;lambda&lt;/span&gt;: char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; char&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; count + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;7&lt;/span&gt;: &lt;span style="color: #ff7700;font-weight:bold;"&gt;lambda&lt;/span&gt;: char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; char&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; count + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;7&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;8&lt;/span&gt;: &lt;span style="color: #ff7700;font-weight:bold;"&gt;lambda&lt;/span&gt;: char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; char&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; count + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;8&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                      &lt;span style="color: #ff4500;"&gt;9&lt;/span&gt;: &lt;span style="color: #ff7700;font-weight:bold;"&gt;lambda&lt;/span&gt;: char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; char&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; row&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; count + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;9&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; count &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;3&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;Winner: %s&amp;quot;&lt;/span&gt; % char&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #dc143c;"&gt;sys&lt;/span&gt;.&lt;span style="color: black;"&gt;exit&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    direction_list &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    direction_list_append &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; direction_list.&lt;span style="color: black;"&gt;append&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;try&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;row&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; char &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_row &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;col - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_col&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            direction &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;4&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;: &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            direction_list_append&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;4&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;elif&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;row&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; char &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_row &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;col + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_col&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction_list_append&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;6&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;elif&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; char &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_row &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;col - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_col&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;7&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction_list_append&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;7&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;elif&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; char &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_row &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; col &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_col&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;8&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction_list_append&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;8&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;elif&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; char &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;row + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_row &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;col + &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; prev_col&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;9&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;              direction_list_append&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;9&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; d &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; direction_list:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            direction_dict&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;d&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;except&lt;/span&gt; &lt;span style="color: #008000;"&gt;IndexError&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;pass&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; __name__ &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;try&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        four_list &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: #008000;"&gt;eval&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #dc143c;"&gt;sys&lt;/span&gt;.&lt;span style="color: black;"&gt;stdin&lt;/span&gt;.&lt;span style="color: black;"&gt;read&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;except&lt;/span&gt; &lt;span style="color: #008000;"&gt;SyntaxError&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;Error getting list from the web, using preprogrammed backup.&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        four_list &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;O&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;O&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;O&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;O&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;O&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;O&amp;quot;&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;X&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                    &lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;finally&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; r&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;_ &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: #008000;"&gt;enumerate&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;char_check&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;r&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;r&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; col&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;_ &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: #008000;"&gt;enumerate&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;r&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; four_list&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;r&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;col&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;No Winner&amp;quot;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Maybe it's my preference for functional programming coming out, but when I looked at this problem I thought “recursion,” remembering from college how much easier it is to solve the &lt;a href="https://en.wikipedia.org/wiki/Tower_of_Hanoi"&gt;Tower of Hanoi&lt;/a&gt; problem with recursion than without.  The problem became a little more complicated when I went from solving the original example to generating and testing a different board.&lt;/p&gt;
&lt;p&gt;At the moment I'm trying to figure out a Haskell version of this solution. Hopefully I'll have one soon and I'll update this page when I do. &lt;/p&gt;
&lt;p&gt;Before I posted this, I wrote a quick email to the person I spoke to at the Thumbtack booth and sent him my solution.  He thanked me for the solution and requested my address to mail a mug to me, which showed up in the mail couple of days ago.  (Below is a pic of the mug filled with a beautiful amber beer.)  He also sent me a link to the company's blog post about their experiences using a coding challenge to earn schwag.  Here is the &lt;a href="http://www.thumbtack.com/engineering/how-we-got-people-to-earn-our-schwag/"&gt;link&lt;/a&gt;.  There are also some pretty impressive solutions to the challenge there, including one done in regular expressions, which deserves a tip of the hat in my book.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://scrollingtext.org/sites/default/files/IMG_20120419_161121.jpg"&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=NZ1rJgzqhio:DR03vx7n8UI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=NZ1rJgzqhio:DR03vx7n8UI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=NZ1rJgzqhio:DR03vx7n8UI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=NZ1rJgzqhio:DR03vx7n8UI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=NZ1rJgzqhio:DR03vx7n8UI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=NZ1rJgzqhio:DR03vx7n8UI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=NZ1rJgzqhio:DR03vx7n8UI:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/NZ1rJgzqhio" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/connect-4#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <pubDate>Thu, 19 Apr 2012 23:58:45 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">82 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/connect-4</feedburner:origLink></item>
<item>
 <title>PyCon</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/nCbKdKbBmqU/pycon</link>
 <description>&lt;p&gt;Hey Everybody, I will be attending the US PyCon starting tomorrow. If anyone of my readers are in town for the convention and are interested, I would happily meet up with you for drinks, food, or whatever. Send me a tweet.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=nCbKdKbBmqU:H6jbXfHA5WM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=nCbKdKbBmqU:H6jbXfHA5WM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=nCbKdKbBmqU:H6jbXfHA5WM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=nCbKdKbBmqU:H6jbXfHA5WM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=nCbKdKbBmqU:H6jbXfHA5WM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=nCbKdKbBmqU:H6jbXfHA5WM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=nCbKdKbBmqU:H6jbXfHA5WM:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/nCbKdKbBmqU" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/pycon#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <pubDate>Thu, 08 Mar 2012 04:52:19 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">81 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/pycon</feedburner:origLink></item>
<item>
 <title>Project Euler: Problem 12</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/a1EtdMWmW5Y/project-euler-problem-12</link>
 <description>&lt;p&gt;It’s time once again for a favorite blog theme, The Project Euler post. This time around I am answering problem twelve. The website states the problem as:&lt;br /&gt;
&lt;quote&gt;The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:&lt;/p&gt;
&lt;p&gt;1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...&lt;/p&gt;
&lt;p&gt;Let us list the factors of the first seven triangle numbers:&lt;/p&gt;
&lt;p&gt; 1: 1&lt;br /&gt;
 3: 1,3&lt;br /&gt;
 6: 1,2,3,6&lt;br /&gt;
10: 1,2,5,10&lt;br /&gt;
15: 1,3,5,15&lt;br /&gt;
21: 1,3,7,21&lt;br /&gt;
28: 1,2,4,7,14,28&lt;br /&gt;
We can see that 28 is the first triangle number to have over five divisors.&lt;/p&gt;
&lt;p&gt;What is the value of the first triangle number to have over five hundred divisors?&lt;/quote&gt;&lt;/p&gt;
&lt;p&gt;o spice things up I decided to use a language I haven't used for these in a while, Perl. I also included the usual suspects: Python and Haskell. So, here's the Perl code:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="perl geshifilter-perl" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #666666; font-style: italic;"&gt;#!/usr/bin/perl&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;use&lt;/span&gt; strict&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;use&lt;/span&gt; warnings&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$index&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;7&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$total&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;28&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$divisors&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;sub&lt;/span&gt; divisors&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;$number&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;@_&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$sq_n&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;a href="http://perldoc.perl.org/functions/sqrt.html"&gt;&lt;span style="color: #000066;"&gt;sqrt&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;$number&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$i&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #b1b100;"&gt;my&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$t&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #b1b100;"&gt;while&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;$i&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;lt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$sq_n&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #0000ff;"&gt;$t&lt;/span&gt; &lt;span style="color: #339933;"&gt;+=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;2&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;unless&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;$number&lt;/span&gt; &lt;span style="color: #339933;"&gt;%&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$i&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #0000ff;"&gt;$i&lt;/span&gt; &lt;span style="color: #339933;"&gt;+=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;a href="http://perldoc.perl.org/functions/return.html"&gt;&lt;span style="color: #000066;"&gt;return&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #0000ff;"&gt;$t&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #b1b100;"&gt;while&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt; divisors&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;$total&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;lt;=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;500&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #0000ff;"&gt;$index&lt;/span&gt; &lt;span style="color: #339933;"&gt;+=&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #0000ff;"&gt;$total&lt;/span&gt; &lt;span style="color: #339933;"&gt;+=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;$index&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;a href="http://perldoc.perl.org/functions/print.html"&gt;&lt;span style="color: #000066;"&gt;print&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #ff0000;"&gt;&amp;quot;$total&lt;span style="color: #000099; font-weight: bold;"&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Nothing really new or interesting to mention in this code.  Here is the Python code:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #808080; font-style: italic;"&gt;#!/usr/bin/python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #483d8b;"&gt;solution for problem 12 in python.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #483d8b;"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;math&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; get_divisors&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;number&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    tlist &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; x &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: #008000;"&gt;xrange&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;2&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #008000;"&gt;int&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #dc143c;"&gt;math&lt;/span&gt;.&lt;span style="color: black;"&gt;sqrt&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;number&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        d&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;r &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: #008000;"&gt;divmod&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;number&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;x&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; r &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;0&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            tlist.&lt;span style="color: black;"&gt;append&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            tlist.&lt;span style="color: black;"&gt;append&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;d&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008000;"&gt;len&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; number&lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt; + tlist&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; triangle_nums&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    iterator &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;7&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    num &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;28&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;while&lt;/span&gt; &lt;span style="color: #008000;"&gt;True&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;yield&lt;/span&gt; num&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        iterator +&lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        num +&lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; iterator&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; __name__ &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    tn &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; triangle_nums&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; t &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; tn:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        tl &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; get_divisors&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;t&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; tl &lt;span style="color: #66cc66;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;500&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;num: %d&lt;span style="color: #000099; font-weight: bold;"&gt;\n&lt;/span&gt;count: %d&amp;quot;&lt;/span&gt; % &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;t&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;tl&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #ff7700;font-weight:bold;"&gt;break&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Pretty standard stuff for the most part. I think the only non-standard thing worth mentioning is the infinite triangle number generator. This took a little finangling, but I got it to work in the end. &lt;/p&gt;
&lt;p&gt;Here is the Haskell code:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;module&lt;/span&gt; Main &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;get&lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt;div&lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt;len number &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldl1"&gt;&lt;span style="font-weight: bold;"&gt;foldl1&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;+&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: red;"&gt;2&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;|&lt;/span&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: red;"&gt;1&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;..&lt;/span&gt;x&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; number `&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:mod"&gt;&lt;span style="font-weight: bold;"&gt;mod&lt;/span&gt;&lt;/a&gt;` x &lt;span style="color: #339933; font-weight: bold;"&gt;==&lt;/span&gt; &lt;span style="color: red;"&gt;0&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:round"&gt;&lt;span style="font-weight: bold;"&gt;round&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sqrt"&gt;&lt;span style="font-weight: bold;"&gt;sqrt&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fromInteger"&gt;&lt;span style="font-weight: bold;"&gt;fromInteger&lt;/span&gt;&lt;/a&gt; number&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;  &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:print"&gt;&lt;span style="font-weight: bold;"&gt;print&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"&gt;&lt;span style="font-weight: bold;"&gt;head&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:dropWhile"&gt;&lt;span style="font-weight: bold;"&gt;dropWhile&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;\x &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fst"&gt;&lt;span style="font-weight: bold;"&gt;fst&lt;/span&gt;&lt;/a&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;=&lt;/span&gt; &lt;span style="color: red;"&gt;499&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;\x &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;get&lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt;div&lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt;len x &lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;x&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; xs&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;  &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; xs &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;\y &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sum"&gt;&lt;span style="font-weight: bold;"&gt;sum&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: red;"&gt;1&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;..&lt;/span&gt;y&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: red;"&gt;7&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;..&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
After creating these solutions, I did my usual, highly accurate, testing method to determine the speed of the computation. I was surprised by my results:&lt;/p&gt;
&lt;p&gt;Perl: 12.462s&lt;br /&gt;
Python: 17.783s&lt;br /&gt;
Haskell (compiled): 13.877s&lt;/p&gt;
&lt;p&gt;Normally the Haskell solution would be significantly faster, and I have a theory as to why the Haskell times are so close.  In Perl and Python I’m doing two additions – one for the increase of the index number and another to increase the total number.  In Haskell I’m doing 1  + n additions; the first is to increase the index, and the remaining additions (n) are those used to calculate the sum of all the numbers between (and including) 1 and the index.  As the index variable gets larger, that calculation takes more and more time to perform.  I would write this up as suboptimal.  After spending some time traveling “the tubes,” I discovered the State Monad, which is the reason why this blog post took me so long.  I had to spend a week going through random blogs, skimming books, and beating my head against a wall (more than usual) to figure this out. &lt;/p&gt;
&lt;p&gt;Quick diversion, for those of you who do not know what the &lt;a href="https://en.wikibooks.org/wiki/Haskell/Understanding_monads/State#Definition_of_the_State_Monad"&gt;State Monad&lt;/a&gt; is, let me take a moment to to try and explain what it is and why it’s important in this context. Those of us that come from an imperative language (I am one of you in this regard) are used to being able to do a simple addition such as (in pseudo code):&lt;/p&gt;
&lt;p&gt;Variable = 2&lt;br /&gt;
Variable = variable + 3 or  Variable += 3&lt;/p&gt;
&lt;p&gt;We can’t do this in Haskell; instead we have to create a new variable name for each new variable assignment.  We could also create a function that recursively goes forward, generating the next number in the sequence and bringing our needed variables with us before going deeper down the recursion rabbit hole.  With the State Monad, however, we can write our function in such a way that the necessary variables are implicitly passed. Take a look at the new solution to see what I mean:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #5d478b; font-style: italic;"&gt;{-# LANGUAGE BangPatterns, UnboxedTuples #-}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;module&lt;/span&gt; Main &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; Control&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Monad"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Monad&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; Control&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Monad"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Monad&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;State&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;type&lt;/span&gt; MyState &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;s0 &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: red;"&gt;7&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: red;"&gt;28&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;tick &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;n&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;o&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; get&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; divs &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; getDivLen &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;n&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;o&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;if&lt;/span&gt; divs &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;=&lt;/span&gt; &lt;span style="color: red;"&gt;500&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #06c; font-weight: bold;"&gt;then&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; n' &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; n &lt;span style="color: #339933; font-weight: bold;"&gt;+&lt;/span&gt; &lt;span style="color: red;"&gt;1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; o' &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; o &lt;span style="color: #339933; font-weight: bold;"&gt;+&lt;/span&gt; n'&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            put &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;n'&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; o'&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            tick&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #06c; font-weight: bold;"&gt;else&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:return"&gt;&lt;span style="font-weight: bold;"&gt;return&lt;/span&gt;&lt;/a&gt; o&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;getDivLen &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; MyState &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;getDivLen &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;!&lt;/span&gt;n&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;!&lt;/span&gt;o&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:foldl1"&gt;&lt;span style="font-weight: bold;"&gt;foldl1&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;+&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: red;"&gt;2&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;|&lt;/span&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: red;"&gt;1&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;..&lt;/span&gt;x&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; o `&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:mod"&gt;&lt;span style="font-weight: bold;"&gt;mod&lt;/span&gt;&lt;/a&gt;` x &lt;span style="color: #339933; font-weight: bold;"&gt;==&lt;/span&gt; &lt;span style="color: red;"&gt;0&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:round"&gt;&lt;span style="font-weight: bold;"&gt;round&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:sqrt"&gt;&lt;span style="font-weight: bold;"&gt;sqrt&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:fromIntegral"&gt;&lt;span style="font-weight: bold;"&gt;fromIntegral&lt;/span&gt;&lt;/a&gt; o&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:print"&gt;&lt;span style="font-weight: bold;"&gt;print&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; evalState tick s0&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
The tick function does not have any input parameters.  All the information that the function needs comes from the “get” function call, which grabs the current state from the State Monad.  If the tick function does not find a number of divisors greater than five hundred, it inserts new values back into the State Monad, and goes down to the next level of recursion.&lt;/p&gt;
&lt;p&gt;It took me a long time to figure this out, mostly because of the lack of examples on the internet concerning the State Monad.  If I wanted to create a random number generator I would have been set, but sadly I just wanted to create something that would hold a tuple of numbers and increment them accordingly. So I highly modified one of the “random number generator” examples.&lt;/p&gt;
&lt;p&gt;My “highly accurate” speed test results for the new version is:&lt;br /&gt;
Haskell (compiled): 2.664s &lt;/p&gt;
&lt;p&gt;which is a vast improvement (&gt; 11s) over the previous implementation. &lt;/p&gt;
&lt;p&gt;While a Project Euler problem may not have been the best way to learn about using the State Monad, I'm glad I stumbled upon it.  I hope that it can be used as an example for others if they want to learn how to use the this particular monad to create things other than pseudo-random number generators.&lt;/p&gt;
&lt;p&gt;One last thing – some of the brighter crayons in the box (which is most of you, based on the level of comments that I receive) might have noticed that I skipped problem 11.  There is a simple response to that.  I still haven’t solved it.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=a1EtdMWmW5Y:_YkY_YAcFis:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=a1EtdMWmW5Y:_YkY_YAcFis:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=a1EtdMWmW5Y:_YkY_YAcFis:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=a1EtdMWmW5Y:_YkY_YAcFis:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=a1EtdMWmW5Y:_YkY_YAcFis:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=a1EtdMWmW5Y:_YkY_YAcFis:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=a1EtdMWmW5Y:_YkY_YAcFis:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/a1EtdMWmW5Y" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/project-euler-problem-12#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/haskell">Haskell</category>
 <category domain="http://scrollingtext.org/category/catagories/perl">PERL</category>
 <category domain="http://scrollingtext.org/category/catagories/project-euler">Project Euler</category>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <pubDate>Mon, 05 Mar 2012 17:57:49 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">80 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/project-euler-problem-12</feedburner:origLink></item>
<item>
 <title>De Morgan’s and (un)Pythonic code</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/bARRlvvCf2U/de-morgan%E2%80%99s-and-unpythonic-code</link>
 <description>&lt;p&gt;&lt;img src="http://scrollingtext.org/sites/default/files/5354727642_f678be9925.jpg"&gt;&lt;br /&gt;
The term “Pythonic” is a subjective and ambiguous one. There are plenty of sites on the internet that try to explain what it means. Some of the better sties will even tell you why one way of doing something is better than another. I am adding my scrollingtext to the latter list.&lt;/p&gt;
&lt;p&gt; I believe that one of the key requirements for writing pythonic code is readability, as briefly mentioned in “The Zen of Python” by Tim Peters. I also believe that this little poem (I use that term loosely here) gives some pretty good hints on how to write pythonic code.  (This is for more of the thought process outside the general coding style stuff defined in &lt;a href="http://www.python.org/dev/peps/pep-0008/"&gt;PEP-8&lt;/a&gt;). Here is the Zen of Python:&lt;br /&gt;
&lt;quote&gt;&lt;br /&gt;
“Beautiful is better than ugly.&lt;br /&gt;
Explicit is better than implicit.&lt;br /&gt;
Simple is better than complex.&lt;br /&gt;
Complex is better than complicated.&lt;br /&gt;
Flat is better than nested.&lt;br /&gt;
Sparse is better than dense.&lt;br /&gt;
Readability counts.&lt;br /&gt;
Special cases aren't special enough to break the rules.&lt;br /&gt;
Although practicality beats purity.&lt;br /&gt;
Errors should never pass silently.&lt;br /&gt;
Unless explicitly silenced.&lt;br /&gt;
In the face of ambiguity, refuse the temptation to guess.&lt;br /&gt;
There should be one-- and preferably only one --obvious way to do it.&lt;br /&gt;
Although that way may not be obvious at first unless you're Dutch.&lt;br /&gt;
Now is better than never.&lt;br /&gt;
Although never is often better than *right* now.&lt;br /&gt;
If the implementation is hard to explain, it's a bad idea.&lt;br /&gt;
If the implementation is easy to explain, it may be a good idea.&lt;br /&gt;
Namespaces are one honking great idea -- let's do more of those!”&lt;br /&gt;
&lt;/quote&gt;&lt;/p&gt;
&lt;p&gt;Since this post is about pythonic code, I want to take a quick moment to show you what I mean, saving you a google search or two in the process. Here is a class method that I would consider non-pythonic code:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; inNodeExistInPool&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #008000;"&gt;self&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; poolName&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; nodeName&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;try&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        currentNodes &lt;span style="color: #66cc66;"&gt;=&lt;/span&gt; &lt;span style="color: #008000;"&gt;self&lt;/span&gt;.__getNodesInPool&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;poolName&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; currentNodes:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; n &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; currentNodes:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        	&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; n &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; nodeName:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        	    &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008000;"&gt;True&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008000;"&gt;False&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;except&lt;/span&gt; &lt;span style="color: #008000;"&gt;Exception&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; e:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;raise&lt;/span&gt; &lt;span style="color: #008000;"&gt;Exception&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;'Exception in isNodeExistInPool: '&lt;/span&gt; + poolName +&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                        &lt;span style="color: #483d8b;"&gt;', Node: '&lt;/span&gt; + nodeName + &lt;span style="color: #483d8b;"&gt;', Error: '&lt;/span&gt; + &lt;span style="color: #008000;"&gt;str&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Now here is a more pythonic version of the same code:&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; isNodeExistInPool&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #008000;"&gt;self&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; poolName&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; nodeName&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;try&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; nodeName &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: #008000;"&gt;self&lt;/span&gt;.__getNodesInPool&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;poolName&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008000;"&gt;True&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;else&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;            &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #008000;"&gt;False&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;except&lt;/span&gt; &lt;span style="color: #008000;"&gt;Exception&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; e:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;raise&lt;/span&gt; &lt;span style="color: #008000;"&gt;Exception&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #483d8b;"&gt;'Exception in isNodeExistInPool: %s, Node: %s, Error: '&lt;/span&gt; %&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;poolName&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; nodeName&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; &lt;span style="color: #008000;"&gt;str&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;e&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;While the first version of the code above is not wrong and would probably be the correct way to do this in other programming languages, it’s not the best way to do it in python. (I also expect to see quite a few comments on how other python programmers might improve the first or second versions of these functions.)&lt;/p&gt;
&lt;p&gt;Now that we have that little example out of the way, let me share with you the motivation for this blog post. At work one day I saw some code that looked like this:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #808080; font-style: italic;"&gt;# ‘a’ being an instance of a class&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt;  &lt;span style="color: #ff7700;font-weight:bold;"&gt;not&lt;/span&gt; a.&lt;span style="color: black;"&gt;att1&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;not&lt;/span&gt; a.&lt;span style="color: black;"&gt;att2&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;not&lt;/span&gt; a.&lt;span style="color: black;"&gt;att3&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;and&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;not&lt;/span&gt; a.&lt;span style="color: black;"&gt;att4&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #808080; font-style: italic;"&gt;# more code down here&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;oddly enough, I remembered De Morgan’s Law from my formal logic courses, so I used it to simplify the expression. Here is the proof (in formal logic notation because it’s quicker):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;~P ^ ~Q ^ ~R ^ ~S&lt;/li&gt;
&lt;li&gt;(~P ^ ~Q) ^ (~R ^  ~S)&lt;/li&gt;
&lt;li&gt;~(P v Q) ^ ~(R v S)&lt;/li&gt;
&lt;li&gt;(~(P v Q) ^ ~(R v S))&lt;/li&gt;
&lt;li&gt;~((P v Q) v (R v S))&lt;/li&gt;
&lt;li&gt;~(P v Q v R v S)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After the logic juggling above I renamed the variables and then modified the code to resemble the ending result:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;not&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;a.&lt;span style="color: black;"&gt;att1&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; a.&lt;span style="color: black;"&gt;att2&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; a.&lt;span style="color: black;"&gt;att3&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;or&lt;/span&gt; a.&lt;span style="color: black;"&gt;att4&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #808080; font-style: italic;"&gt;# still more code down here&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;After the change we can immediately see that I’ve reduced number of not calls. While I’m sure there is some performance improvement, I seriously doubt that it’s something that might be noticed by a human being, so we’ll just discount this as any form of optimization. I believe I’ve also made the code easier to read. The line itself is smaller, so a maintainer would have less “things” to juggle in their head to verify that the expression should pass or fail. Thus this code change has fulfilled some of the ideas in the “Zen of Python,” particularly the parts about “Simple is better than complex,” and “Readability counts.” However, in the final product I’ve had to add some parentheses in order for the logic to be correct, and this is where my ultimate question lies. In a lot of “pythonic” code examples on the web, one doesn’t really see “if” statements written like this one. So a somewhat self-conscious part of me thinks that I even though I have gone through the trouble of trying to make the code cleaner, I still haven’t gotten the code to be “pythonic”.&lt;/p&gt;
&lt;p&gt;After thinking about it a little more, I decided that my version is pythonic. While I did add some clutter by adding parentheses, I also removed 3 “not calls” and made the line easier to understand. I believe this follows the spirit of pythonic code, even if it does not follow the the code to the letter.&lt;/p&gt;
&lt;p&gt;Top photo credit goes to: &lt;a href="http://www.flickr.com/photos/mromtz/"&gt;mromtz&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=bARRlvvCf2U:T-VP3rpMe0g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=bARRlvvCf2U:T-VP3rpMe0g:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=bARRlvvCf2U:T-VP3rpMe0g:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=bARRlvvCf2U:T-VP3rpMe0g:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=bARRlvvCf2U:T-VP3rpMe0g:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=bARRlvvCf2U:T-VP3rpMe0g:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=bARRlvvCf2U:T-VP3rpMe0g:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/bARRlvvCf2U" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/de-morgan%E2%80%99s-and-unpythonic-code#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <pubDate>Tue, 17 Jan 2012 22:54:06 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">79 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/de-morgan%E2%80%99s-and-unpythonic-code</feedburner:origLink></item>
<item>
 <title>Pangrams</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/Ky7Qi6qx1bg/pangrams</link>
 <description>&lt;p&gt;&lt;img src="http://farm1.staticflickr.com/41/96825282_b2548336c0.jpg"&gt;&lt;br /&gt;
If you haven’t figured it out by now, I enjoy solving problems.  And over the course of the last year or two, I’ve learned that interview questions make for great problems to work on.  Actual interview problems are nice because they are usually quick, but have a quirk or two in there that makes them challenging, unlike simple questions like the &lt;a href="http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/"&gt;Fizz Buzz&lt;/a&gt; problem that just checks if you have the most basic coding skills. (Has anyone actually been asked that question in an interview?)&lt;/p&gt;
&lt;p&gt;The most recent problem I got to sink my teeth into (found it on a recruiting site, but not going to share where I got it; wouldn’t be fair to the company posting the problem) is for finding pangrams in sentences.  If you don’t know what a pangram is &lt;a href="http://en.wikipedia.org/wiki/Pangram"&gt;Wikipedia&lt;/a&gt; defines them as, “a sentence using every letter of the alphabet at least once.”  Yeah, I didn’t know what they were either until I started programming this little puzzle. Here is the code:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;module&lt;/span&gt; Main &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;main&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; System &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;getArgs&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;qualified&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Set &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt; S&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;qualified&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt; T&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;qualified&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt; TI &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:readFile"&gt;&lt;span style="font-weight: bold;"&gt;readFile&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;buildList &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; FilePath &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:IO"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;IO&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Text&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;buildList filename &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; TI&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:readFile"&gt;&lt;span style="font-weight: bold;"&gt;readFile&lt;/span&gt;&lt;/a&gt; filename &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;gt;&amp;gt;=&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:return"&gt;&lt;span style="font-weight: bold;"&gt;return&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;toLower &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:filter"&gt;&lt;span style="font-weight: bold;"&gt;filter&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;/=&lt;/span&gt;' '&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:lines"&gt;&lt;span style="font-weight: bold;"&gt;lines&lt;/span&gt;&lt;/a&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;compareAndPrint &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; S&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;Set &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Char"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Char&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:String"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;compareAndPrint sset &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;if&lt;/span&gt; S&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:null"&gt;&lt;span style="font-weight: bold;"&gt;null&lt;/span&gt;&lt;/a&gt; result&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #06c; font-weight: bold;"&gt;then&lt;/span&gt; &lt;span style="background-color: #3cb371;"&gt;&amp;quot;NULL&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                       &lt;span style="color: #06c; font-weight: bold;"&gt;else&lt;/span&gt; S&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;toList result&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;  &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; result &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; S&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;difference &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;S&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;fromList &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;'a'&lt;span style="color: #339933; font-weight: bold;"&gt;..&lt;/span&gt;'z'&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; sset&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;main &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;do&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;  args &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; getArgs&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;  sentences &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; buildList &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:head"&gt;&lt;span style="font-weight: bold;"&gt;head&lt;/span&gt;&lt;/a&gt; args&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;  &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:mapM_"&gt;&lt;span style="font-weight: bold;"&gt;mapM_&lt;/span&gt;&lt;/a&gt;  &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:putStrLn"&gt;&lt;span style="font-weight: bold;"&gt;putStrLn&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; compareAndPrint&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;$&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:map"&gt;&lt;span style="font-weight: bold;"&gt;map&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt; S&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;fromList &lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt; T&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;unpack&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; sentences &lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;I came up with the solution pretty quickly by using Sets. Having a set of the alphabet and finding the difference of the letters used in the sentence makes the problem almost trivial. The hard part for me was figuring out how to filter out the spaces and change all characters to lower case in the buildList function. I eventually figured it out, but it took some head against wall action to get it right.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://farm6.staticflickr.com/5248/5271625268_2ae0f4b880.jpg"&gt;&lt;/p&gt;
&lt;p&gt;This is going to be my last post for this year. I would like to wish you all Happy Holidays and a Happy New Year. Thank for reading and see you again in 2012.  I would also like to thank everyone from planet.haskell.org who decided to read this.  Welcome!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=Ky7Qi6qx1bg:-XGdlm4l4F0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=Ky7Qi6qx1bg:-XGdlm4l4F0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=Ky7Qi6qx1bg:-XGdlm4l4F0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=Ky7Qi6qx1bg:-XGdlm4l4F0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=Ky7Qi6qx1bg:-XGdlm4l4F0:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=Ky7Qi6qx1bg:-XGdlm4l4F0:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=Ky7Qi6qx1bg:-XGdlm4l4F0:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/Ky7Qi6qx1bg" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/pangrams#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/haskell">Haskell</category>
 <pubDate>Thu, 29 Dec 2011 17:30:30 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">78 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/pangrams</feedburner:origLink></item>
<item>
 <title>99 bottles</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/zXjXVbwT8NE/99-bottles</link>
 <description>&lt;p&gt;It’s been a while since I put up one of these simple code posts. Let me fix that. :P&lt;/p&gt;
&lt;p&gt;Quiet a while ago, this code needed to have the dust blown off of it.  Programming Praxis had its readers program out the song for &lt;a hreg="http://programmingpraxis.com/2011/08/05/ninety-nine-bottles-of-beer/"&gt;“Nintey-Nine Bottles of Beer on the Wall"&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is my version of it:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="python geshifilter-python" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #808080; font-style: italic;"&gt;#!/usr/bin/env python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;from&lt;/span&gt; &lt;span style="color: #dc143c;"&gt;__future__&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;import&lt;/span&gt; print_function&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;def&lt;/span&gt; output&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;in_int&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; in_int &lt;span style="color: #66cc66;"&gt;!=&lt;/span&gt; &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;%d bottles of beer on the wall, %d bottles of beer.&amp;quot;&lt;/span&gt; \&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                &lt;span style="color: #483d8b;"&gt;&amp;quot;You take one down, pass it around, %d bottles of beer&amp;quot;&lt;/span&gt; \&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                &lt;span style="color: #483d8b;"&gt;&amp;quot;on the wall.&amp;quot;&lt;/span&gt; % &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;in_int&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;in_int&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; in_int - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: #ff7700;font-weight:bold;"&gt;else&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;        &lt;span style="color: #ff7700;font-weight:bold;"&gt;return&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;%d bottle of beer on the wall, %d bottle of beer.&amp;quot;&lt;/span&gt; \&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                &lt;span style="color: #483d8b;"&gt;&amp;quot;You take one down, pass it around, %d bottles of beer&amp;quot;&lt;/span&gt; \&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                &lt;span style="color: #483d8b;"&gt;&amp;quot;on the wall.&amp;quot;&lt;/span&gt; % &lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;in_int&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;in_int&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt; in_int - &lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #ff7700;font-weight:bold;"&gt;if&lt;/span&gt; __name__ &lt;span style="color: #66cc66;"&gt;==&lt;/span&gt; &lt;span style="color: #483d8b;"&gt;&amp;quot;__main__&amp;quot;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;    &lt;span style="color: black;"&gt;&amp;#91;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;print&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;output&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #ff7700;font-weight:bold;"&gt;for&lt;/span&gt; x &lt;span style="color: #ff7700;font-weight:bold;"&gt;in&lt;/span&gt; &lt;span style="color: #008000;"&gt;reversed&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #008000;"&gt;xrange&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;1&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;,&lt;/span&gt;&lt;span style="color: #ff4500;"&gt;99&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: black;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;That’s all there is to it really. The only enlightening thing about this I can say is that this algorithm reminds me a lot of my &lt;a href="http://scrollingtext.org/code-lyrics"&gt;Code to lyrics&lt;/a&gt; post I wrote a little over a year ago.  It’s amazing how simple songs are when they’re broken down to their basic elements.  Anyone feel like setting up an “automatic song generation” business with me?&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=zXjXVbwT8NE:d2GwsHQ4yXs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=zXjXVbwT8NE:d2GwsHQ4yXs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=zXjXVbwT8NE:d2GwsHQ4yXs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=zXjXVbwT8NE:d2GwsHQ4yXs:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=zXjXVbwT8NE:d2GwsHQ4yXs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=zXjXVbwT8NE:d2GwsHQ4yXs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=zXjXVbwT8NE:d2GwsHQ4yXs:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/zXjXVbwT8NE" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/99-bottles#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/programming-praxis">Programming Praxis</category>
 <category domain="http://scrollingtext.org/category/catagories/python">Python</category>
 <pubDate>Tue, 06 Dec 2011 01:33:14 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">77 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/99-bottles</feedburner:origLink></item>
<item>
 <title>Git Churn</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/BJikolliE9Y/git-churn</link>
 <description>&lt;p&gt;I’m still really on the fence regarding the flame war between Git and Mercurial; they both have their strengths and weaknesses.  (In case you’re wondering, the reason I haven’t been forced to make a decision yet is because $WORK uses Perforce &lt;shudders&gt;.)  When I learn about one trick in one of these tools, I try to see if that trick is possible in the other. So far this search has been pretty limited, and both applications seem to be equally capable.&lt;/p&gt;
&lt;p&gt;My buddy &lt;a href="http://buffered.io/"&gt;OJ&lt;/a&gt; pointed me out to a Mercurial extension called &lt;a href="http://mercurial.selenic.com/wiki/ChurnExtension"&gt;churn&lt;/a&gt;, which is a pretty nifty tool. It allows you to quickly see who made how many changes to either a particular file or an entire repo (emails removed to avoid these people being spammed).&lt;/p&gt;
&lt;p&gt;guido                 1970354 *******************************************************************&lt;br /&gt;
jack.jansen               1665771 *********************************************************&lt;br /&gt;
solipsis              1588311 ******************************************************&lt;br /&gt;
georg                 1331332 *********************************************&lt;br /&gt;
martin               1005541 **********************************&lt;br /&gt;
benjamin              697038 ************************&lt;br /&gt;
thomas                460885 ****************&lt;br /&gt;
christian             445461 ***************&lt;br /&gt;
fdrake                   437229 ***************&lt;br /&gt;
tools                 418957 **************&lt;/p&gt;
&lt;p&gt;After finding out about this cool little feature I decided to see if Git had something similar. After a little digging around I came across this thread on StackOverflow(2) which talked about the Git &lt;a href="http://man.he.net/man1/git-shortlog"&gt;shortlog&lt;/a&gt; command. Running this command with the “-sne” argument (as given from the StackOverflow page) on my Project Euler git repo returned these results:&lt;/p&gt;
&lt;p&gt;129  Bryce Verdier &lt;btv@zetta.net&gt;&lt;br /&gt;
    42  Bryce Verdier &lt;bryceverdier@gmail.com&gt;&lt;br /&gt;
     4  Bryce &lt;bryceverdier@gmail.com&gt;&lt;br /&gt;
     1  bryce &lt;bryce@bryce-desktop.(none)&gt;&lt;/p&gt;
&lt;p&gt;While there are mentions of the gitstats project, I didn’t want to bring that into the equation. I just want to compare the core applications. Using a third party application, like gitstats, wouldn’t be fair to Mercurial.&lt;/p&gt;
&lt;p&gt;Seeing how both of these tools seemed to have similar capabilities, I decided to investigate a little more. I started off by trying to see if there might have been a flag to remove the stars from the Mercurial churn output; while the stars are cool, I think the Git output looks cleaner without them. Sadly, there isn’t a flag in churn to remove the stars. &lt;/p&gt;
&lt;p&gt;One thing I did like about churn over Git shortlog was the ability to see either the number of lines changed or the number of change sets. I think that having more options for how you want information presented is a good thing. I also liked the output of churn over that of shortlog. I want to see the user information before I see the number of changes they made; I think it’s easier to process information that way than the other way around. Sadly, even though there is a quite a lot of documentation regarding formatting within the git log man page, there doesn’t seem to be a print variable for summarizing one’s commits. Or for changing the formatting if one uses the “-s” flag in the shortlog command.&lt;/p&gt;
&lt;p&gt;As hard as I tried to break the tie between Git and Mercurial, these two particular extensions each have their own advantages and disadvantages.  While it might be ideal to attempt to combine churn and shortlog into the ULTIMATE CHANGE TRACKING EXTENSION, that is a task for another day (and probably another programmer.)  I guess the flame war between these two tools is just going to have to continue for a little while longer.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=BJikolliE9Y:qiwLcHW3GBk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=BJikolliE9Y:qiwLcHW3GBk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=BJikolliE9Y:qiwLcHW3GBk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=BJikolliE9Y:qiwLcHW3GBk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=BJikolliE9Y:qiwLcHW3GBk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=BJikolliE9Y:qiwLcHW3GBk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=BJikolliE9Y:qiwLcHW3GBk:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/BJikolliE9Y" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/git-churn#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/git">Git</category>
 <category domain="http://scrollingtext.org/category/catagories/mercurial">Mercurial</category>
 <pubDate>Tue, 01 Nov 2011 16:36:10 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">76 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/git-churn</feedburner:origLink></item>
<item>
 <title>Programming Praxis: The Sum of Two Integers</title>
 <link>http://feedproxy.google.com/~r/Scrollingtext/~3/ujDYrnmNfn0/programming-praxis-sum-two-integers</link>
 <description>&lt;p&gt;A couple of months ago the Programming Praxis website put up a challenge to find a sum inside an array of integers (the direct wording of the challenge can be found &lt;a href="http://programmingpraxis.com/2011/07/19/sum-of-two-integers/"&gt;here&lt;/a&gt;) and since I’ve come up with my own solution, this little challenge has provided me with a lot of feedback.&lt;/p&gt;
&lt;p&gt;Just to get some of the geeky stuff out of the way, here is the code I wrote for the problem:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;List&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;import&lt;/span&gt; Data&lt;span style="color: #339933; font-weight: bold;"&gt;.&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Maybe&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sumCheck &lt;span style="color: #339933; font-weight: bold;"&gt;::&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;-&amp;gt;&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Maybe&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int"&gt;&lt;span style="color: #cccc00; font-weight: bold;"&gt;Int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sumCheck &lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;_&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; Nothing&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sumCheck total &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;x:xs&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; ys &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;if&lt;/span&gt; total' &lt;span style="color: #339933; font-weight: bold;"&gt;==&lt;/span&gt; Nothing &lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                                &lt;span style="color: #06c; font-weight: bold;"&gt;then&lt;/span&gt; sumCheck total xs ys&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                                &lt;span style="color: #06c; font-weight: bold;"&gt;else&lt;/span&gt; &lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:return"&gt;&lt;span style="font-weight: bold;"&gt;return&lt;/span&gt;&lt;/a&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;ys &lt;span style="color: #339933; font-weight: bold;"&gt;!!&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt; fromJust total'&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                           &lt;span style="color: #06c; font-weight: bold;"&gt;where&lt;/span&gt; total' &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;total &lt;span style="color: #339933; font-weight: bold;"&gt;-&lt;/span&gt; x&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; `elemIndex` ys &lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
In thinking about the problem a little bit I came up with this subtraction approach. My first approach was to use addition and add every item in the array against all the other items. But this method didn’t sit well with me. After a little bike ride I came up with the code you see above.&lt;/p&gt;
&lt;p&gt;After I wrote it, I submitted my code to the Haskell-beginners email list asking for critiques and possible enhancements. Arlen Cuss contributed a slight improvement of my code:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sumCheck total &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;x:xs&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; ys &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;&lt;span style="color: #06c; font-weight: bold;"&gt;let&lt;/span&gt; diff &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; total &lt;span style="color: #339933; font-weight: bold;"&gt;-&lt;/span&gt; x&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;               &lt;span style="color: #06c; font-weight: bold;"&gt;in&lt;/span&gt;  &lt;span style="color: #06c; font-weight: bold;"&gt;if&lt;/span&gt; diff `&lt;a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:elem"&gt;&lt;span style="font-weight: bold;"&gt;elem&lt;/span&gt;&lt;/a&gt;` ys&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #06c; font-weight: bold;"&gt;then&lt;/span&gt; Just &lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; diff&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-family: monospace; font-weight: bold; font-style: italic;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;                              &lt;span style="color: #06c; font-weight: bold;"&gt;else&lt;/span&gt; sumCheck total xs ys&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
And Adityz Siram contributed his version. Which is basically the first algorithm that I came up with and wanted to improve upon. His code is here:&lt;br /&gt;
&lt;div class="geshifilter"&gt;&lt;pre class="haskell geshifilter-haskell" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-family: monospace; font-weight: normal;"&gt;&lt;div style="font-family: monospace; font-weight: normal; font-style: normal"&gt;sums i &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt; bs &lt;span style="color: #339933; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span style="color: green;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: green;"&gt;&amp;#40;&lt;/span&gt;x&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt;y&lt;span style="color: green;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #339933; font-weight: bold;"&gt;|&lt;/span&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; &lt;span style="color: #06c; font-weight: bold;"&gt;as&lt;/span&gt;&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; y &lt;span style="color: #339933; font-weight: bold;"&gt;&amp;lt;-&lt;/span&gt; bs&lt;span style="color: #339933; font-weight: bold;"&gt;,&lt;/span&gt; x &lt;span style="color: #339933; font-weight: bold;"&gt;+&lt;/span&gt; y &lt;span style="color: #339933; font-weight: bold;"&gt;==&lt;/span&gt; i&lt;span style="color: green;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Finally, Gary Klindt took all of our code snippets, used some performance analysis tools inside GHC and came up with some run times that are (hopefully) more accurate than running time on an application. Here are those stats:&lt;br /&gt;
print $ sumCheck 500 [1..1000] [1..1000]&lt;br /&gt;
sumCheck1: 58,648&lt;br /&gt;
sumCheck2: 58,484&lt;br /&gt;
sumCheck3: 70,016&lt;/p&gt;
&lt;p&gt;print $ sumCheck 5000 [1..10000] [1..10000]&lt;br /&gt;
sumCheck1: 238,668&lt;br /&gt;
sumCheck2: 238,504&lt;br /&gt;
sumCheck3: 358,016&lt;br /&gt;
(unit: byte)&lt;/p&gt;
&lt;p&gt;Out of the three code snippets, my function was in the middle, speed-wise. But I think that it’s also really nice to see how much better it is than the regular addition method. It’s also nice to see how the little change made to my code can improve the overall speed of the function.&lt;/p&gt;
&lt;p&gt;At the end of the day I take a little bit of pride in myself for coming up with an improved algorithm for this task on my own. I know that on a hardware level, subtraction takes more time than addition. But I get the improvements I get because I reduce the number of additions and comparisons I have to make in order for the function to be complete. I also estimate the worst case speed for my algorithm to be O(n), which isn’t too shabby.&lt;/p&gt;
&lt;p&gt;When I started learning Haskell, one of the things I read on the internet was how the people who programmed it were helpful to one another. I was skeptical when I first read that, but I have to say that all of my doubt has been removed. And it is interactions like this that make me glad to participate in a community as helpful as this one.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=ujDYrnmNfn0:j31b6lhOGlc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=ujDYrnmNfn0:j31b6lhOGlc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=ujDYrnmNfn0:j31b6lhOGlc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=ujDYrnmNfn0:j31b6lhOGlc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=ujDYrnmNfn0:j31b6lhOGlc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?i=ujDYrnmNfn0:j31b6lhOGlc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Scrollingtext?a=ujDYrnmNfn0:j31b6lhOGlc:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Scrollingtext?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Scrollingtext/~4/ujDYrnmNfn0" height="1" width="1"/&gt;</description>
 <comments>http://scrollingtext.org/programming-praxis-sum-two-integers#comments</comments>
 <category domain="http://scrollingtext.org/category/catagories/haskell">Haskell</category>
 <category domain="http://scrollingtext.org/category/catagories/programming-praxis">Programming Praxis</category>
 <pubDate>Wed, 05 Oct 2011 16:12:28 +0000</pubDate>
 <dc:creator>Bryce</dc:creator>
 <guid isPermaLink="false">75 at http://scrollingtext.org</guid>
<feedburner:origLink>http://scrollingtext.org/programming-praxis-sum-two-integers</feedburner:origLink></item>
</channel>
</rss>

