<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8609545074698148243</id><updated>2011-11-28T01:21:51.641+01:00</updated><category term='Text Twist'/><category term='Paddles and Balls'/><category term='Project Euler'/><category term='Wix Standardizer'/><category term='Beta Testing'/><category term='Game Design'/><category term='Villains Hope'/><category term='External Projects'/><category term='Website News'/><category term='Programming Tips'/><category term='Word Scramble'/><category term='Open Source Projects'/><title type='text'>The Musings of an Adkins</title><subtitle type='html'>The random musing of Christopher B. Adkins.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>53</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8958323278536856645</id><published>2011-07-10T12:01:00.042+02:00</published><updated>2011-07-10T12:01:00.629+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 16</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 16 of my Project Euler series.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 16&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;What is the sum of the digits of the number&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;2&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;&lt;sup&gt;1000&lt;/sup&gt;&lt;/span&gt;?&lt;/div&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;2&lt;sup&gt;15&lt;/sup&gt;&amp;nbsp;= 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.&lt;/div&gt;&lt;div style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;What is the sum of the digits of the number 2&lt;sup&gt;1000&lt;/sup&gt;?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;//What is the sum of the digits of the number&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;2&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;&lt;sup&gt;1000&lt;/sup&gt;&lt;/span&gt;?&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0016&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;const int numberBase = 10; // The base that we are going to be using (2, 10, and 16 are the most common)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;const int power = 1000; // The power that will be used.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int arraySize = power / (numberBase * 3); // The size of the array can be approximated to the power / base * 3&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int[] bigNumber = new int[arraySize + 1];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;bigNumber[0] = 2; // Our big number will start as 2.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 2; i &amp;lt;= power; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;DoubleNumber(bigNumber);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;var numberAsString = NumberToString(bigNumber);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.WriteLine("The sum of digits of 2^" + power + " is " + SumTheDigits(numberAsString));&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;private static void DoubleNumber(int[] n)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int carry = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 0; i &amp;lt; n.Length; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;n[i] &amp;lt;&amp;lt;= 1;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;n[i] += carry;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if (n[i] &amp;gt;= 1000000000)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;carry = 1;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;n[i] -= 1000000000;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;else&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;carry = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;private static String NumberToString(int[] n)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int i = n.Length;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;while (i &amp;gt; 0 &amp;amp;&amp;amp; n[--i] == 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String ret = "" + n[i--];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;while (i &amp;gt;= 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;ret += String.Format("{0:000000000}", n[i--]);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return ret;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;private static int SumTheDigits(string text)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int returnValue = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;foreach (var number in text)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;returnValue += int.Parse(number.ToString());&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return returnValue;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This one requires a little more digging into what was learned long long ago in math. &amp;nbsp;It also involves thinking about more than just "int" or "long" to get it figured out. We have once again a number that is going to be well beyond the scale of what is available to us for numeric data types. &amp;nbsp;That hasn't stood in our way before and it won't this time either. We are going to take a, once again, different approach to things. &amp;nbsp;This time we are going to work with the number as if it were an array. &amp;nbsp;The trick is that we are going to work with an array of 9 digit numbers (numbers under 1 billion).&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;As we all might or might not know a signed int has a value right around +- 2 billion. That would be a bit awkward to work with if we are going to be using the various elements of the array for continuous calculations. &amp;nbsp;We can however put a cap on the number that we use where ever we want to. If we wanted to work with over sized arrays, we could just as easily have worked with the 3 digit numbers (under 1 thousand). &amp;nbsp;For simplicity though, we went with the largest number that .NET data types would allow.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;If you check out the DoubleNumber method you will get a better idea of what I mean. I am doing binary addition to each number in the array. If there is something that goes over our 9 digit cap that we self imposed, then it is used as a carry over into the next element of the array. &amp;nbsp;At the end we get a truly impressive sized number to work with. &amp;nbsp;That is also why we have to transfer it into a string in order to add all the digits. &amp;nbsp;I suppose technically it would have worked to just pace through the array and do it that way, but I had implemented the method to turn it into a string in order to check my output during testing and solving of it, so I just left it in and used it here.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This brings me to another good point. I decided to start breaking this code up into methods for two reasons. First off, I was having some issues when I was trouble shooting the code and wanted to get things a little more spread out and easier to work with. Once I was able to get the return value I wanted and expected from a method then I knew that that chunk of code worked. &amp;nbsp;I could safely move on and let the method enjoy a long and happy life. &amp;nbsp;That actually ties directly into the second reason; Readability. To really prove this point, I will put some extra code onto my&amp;nbsp;Google&amp;nbsp;code repository. &amp;nbsp;I could have very easily squeezed all this code into the main method and not had to worry about making sure my method calls were right and my return values were what I wanted. The problem is that I would have then had a very hard task ahead of me when I started trying to isolate code for debugging purposes. It would have been possible (and shorter) but the readability and future&amp;nbsp;maintenance&amp;nbsp;would have suffered. I like to consider the rule of thumb that a method should fit comfortably on your screen. &amp;nbsp;Of course buying a bigger screen is not the solution if it doesn't but rather trying to take out some code that both, logically fits together, and is capable of standing alone without causing issues. Since it is a rule of thumb it is not necessary to do, but rather nice if possible. &amp;nbsp;It allows you to focus one line of thought on the screen at a time.&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Until next time...&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8958323278536856645?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8958323278536856645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/07/project-euler-problem-16.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8958323278536856645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8958323278536856645'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/07/project-euler-problem-16.html' title='Project Euler - Problem 16'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-6183538847163270242</id><published>2011-07-03T12:01:00.016+02:00</published><updated>2011-07-03T12:01:01.056+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 15</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 15 of my Project Euler series.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 15&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner?&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;Starting in the top left corner of a 2&lt;img alt="×" border="0" height="9" src="http://projecteuler.net/images/symbol_times.gif" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; vertical-align: middle;" width="9" /&gt;2 grid, there are 6 routes (without backtracking) to the bottom right corner.&lt;/div&gt;&lt;div style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px; text-align: center;"&gt;&lt;img alt="" src="http://projecteuler.net/project/images/p_015.gif" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px;" /&gt;&lt;/div&gt;&lt;div style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;How many routes are there through a 20&lt;img alt="×" border="0" height="9" src="http://projecteuler.net/images/symbol_times.gif" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; vertical-align: middle;" width="9" /&gt;20 grid?&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner?&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0015&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.WriteLine(binomialCoefficient(40,20));&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public static long binomialCoefficient(int n, int k)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;long c = 1;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 0; i &amp;lt; k; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;c = c * (n - i);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;c = c / (i + 1);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return c;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The code for this one is short, sweet, and to the point. &amp;nbsp;The journey there was not however. This one required a lot of research on my part to come to the answer. Once I was there and it all started to come back however it was painfully obvious. I really hate how&amp;nbsp;hindsight&amp;nbsp;has 20/20 vision. It would be so much more useful to have that kind of clarity before hand.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;What I ended up going with was the equation for a simple Binomial Equation as it was the fastest of the options available and the most straight forward. I simply had to implement&amp;nbsp;&lt;img alt="{n \choose k+1} = \frac{n-k}{k+1} {n \choose k} " src="http://upload.wikimedia.org/math/8/9/e/89eb4d3cdc20a99eef9d33f37e913f4e.png" /&gt;&amp;nbsp;in C#. &amp;nbsp;Simple right? &amp;nbsp;Once you have a grasp of C# and binomial&amp;nbsp;coefficients&amp;nbsp;it really is. &amp;nbsp;The only real&amp;nbsp;question&amp;nbsp;that was left over was, what are n and k in this example? &amp;nbsp;In reading some interesting articles about&amp;nbsp;path finding, I found people using this equation to solve the number of paths from one side of a 2d map to the other. &amp;nbsp;k was the&amp;nbsp;length&amp;nbsp;of on of the sides and n was the number of steps from one side to the other. &amp;nbsp;Plop&amp;nbsp;those in the&amp;nbsp;proper&amp;nbsp;place in your equation and you have yourself an answer.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Until next time...&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-6183538847163270242?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/6183538847163270242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/07/project-euler-problem-15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6183538847163270242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6183538847163270242'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/07/project-euler-problem-15.html' title='Project Euler - Problem 15'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-6413850710931752034</id><published>2011-06-29T13:42:00.041+02:00</published><updated>2011-06-29T13:42:00.253+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming Tips'/><title type='text'>Variable names are overly important</title><content type='html'>As you might or might not have read in my previous post (&lt;a href="http://blog.adkins-software.com/2011/06/project-euler-problem-14.html"&gt;Project Euler Problem 14&lt;/a&gt;) I value a good variable name above a great many other things in life. &amp;nbsp;That might seem a bit&amp;nbsp;exaggerated, but really it isn't. If you need proof, then break out some of your old code (by old I mean more than 12 months without having looked at it) and try to remember what you were doing and why. &amp;nbsp;It is not nearly as easy as you might think. The problem is, projects come and go for programs pretty rapidly. &amp;nbsp;Those past projects, no matter how brilliant they were at the time, are simply that. They are past projects. &amp;nbsp;Most programmers don't take the time, when they stop work on a project, to document what exactly they were planning for it, working on, struggling with, etc. &amp;nbsp;Most projects are abandoned for something bigger and better. It is the nature of working in a cutting edge field. There is always that allure to the bigger and better. That is where the value of variable names can really shine through (if properly implemented with other good practices that I will mention at the end of this).&lt;br /&gt;&lt;br /&gt;decimal x = 100.00m;&lt;br /&gt;decimal y = 2.34m;&lt;br /&gt;x*=y;&lt;br /&gt;&lt;br /&gt;What are those three (perfectly legal) C# statements doing? &amp;nbsp;Could be anything really and if a method has a chunk like that with some error checking and a return statement you are going to be left in the dark.&lt;br /&gt;&lt;br /&gt;decimal capital = 100.00m;&lt;br /&gt;decimal interest = 2.34m;&lt;br /&gt;capital *= interest;&lt;br /&gt;&lt;br /&gt;What are those three (perfectly legal) C# statements doing? &amp;nbsp;Well as you can plainly see they are implementing a gross&amp;nbsp;simplification&amp;nbsp;of interest calculations.&amp;nbsp;The example might not be the best, but the principle stands. &amp;nbsp;With proper variable names the logic of the code can make more sense.&lt;br /&gt;&lt;br /&gt;Aside from just helping improve the logic, well thought out variable names can also cut back on the number of &amp;nbsp;comments that you have to write. In the second example that I gave above I could have added in comments stating that I was calculating interest, but they are not at all needed. The vast majority of people that can program have had enough math that they would recognize that. &amp;nbsp;I would even go so far as to say that it is more often true, rather than not, that properly improved variable names will reduce the amount of commenting that is needed.&lt;br /&gt;&lt;br /&gt;This practice of using well thought out variable names can actual lead to better comments that are actually read instead of just skipped over. If you are replacing good naming conventions with comments that means that the person reading your code has to take a break from the code and read the comments to see what this particular variable is supposed to do or supposed to represent. &amp;nbsp;I think it is pretty obvious why this is a bad thing.&lt;br /&gt;&lt;br /&gt;Aside from good variable names, the readability of your code can be improved by including comments where needed to clarify what is not evident from the code itself, keeping method size down so it can all be viewed on the screen at once, and experience. I know the last one is kind of mean, but it is true. Sometimes only experience can teach the student what the teacher knows.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-6413850710931752034?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/6413850710931752034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/variable-names-are-overly-important.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6413850710931752034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6413850710931752034'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/variable-names-are-overly-important.html' title='Variable names are overly important'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7701864143013799502</id><published>2011-06-26T12:01:00.001+02:00</published><updated>2011-06-26T12:01:00.413+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 14</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 14 of my Project Euler series.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 14&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;Find the longest sequence using a starting number under one million.&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;The following iterative sequence is defined for the set of positive integers:&lt;br /&gt;&lt;br /&gt;n &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; n/2 (n is even)&lt;br /&gt;n &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 3n + 1 (n is odd)&lt;br /&gt;&lt;br /&gt;Using the rule above and starting with 13, we generate the following sequence:&lt;br /&gt;13 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 40 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 20 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 10 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 5 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 16 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 8 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 4 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 2 &lt;img border="0" src="http://projecteuler.net/images/symbol_maps.gif" /&gt; 1&lt;br /&gt;&lt;br /&gt;It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.&lt;br /&gt;&lt;br /&gt;Which starting number, under one million, produces the longest chain?&lt;br /&gt;&lt;div class="info" style="font-family: 'Trebuchet MS', sans-serif; font-size: 13px; font-weight: normal;"&gt;&lt;b&gt;NOTE:&lt;/b&gt;&amp;nbsp;Once the chain starts the terms are allowed to go above one million.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Find the longest sequence using a starting number under one million.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0014&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int startOfLongest = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int longestChain = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 1; i &amp;lt; 1000000; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;int chainLength = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;long n = i;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;while (n &amp;gt; 1)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (n % 2 == 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;n /= 2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;else&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;n = (3 * n) + 1;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;chainLength++;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if (chainLength &amp;gt; longestChain)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;longestChain = chainLength;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;startOfLongest = i;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.WriteLine(startOfLongest);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This is an interesting problem. We have the solution given to us, we just have to use it to find right answer. The algorithm that we are following is that we will divide an even number by 2 and triple an odd number then add one. &amp;nbsp;We will continue this pattern until we get the number down to one. This seems easy enough, except that we are looking for the number with the longest chain. &amp;nbsp;Theoretically every number will end up at one so we are looking for the one that takes the longest to get there.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;We got our starting point (one) and our ending point (999,999) and our route. &amp;nbsp;Now to implement it. &amp;nbsp;We obviously need a loop (in the shape of a "while" since we don't actually have a set number of iterations to complete) and a couple of "if" statements in the middle to handle each situation. The rest is simply translating the algorithm into source code. &amp;nbsp;This is a very important skill to master, because most people that are going to tell you what they want from programs are not going to tell you in source code, or even easily translated pseudo code. &amp;nbsp;If they were already that far along in the software&amp;nbsp;development&amp;nbsp;cycle they would most likely finish it themselves!&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;One final note before I finish this off for today. &amp;nbsp;&lt;i&gt;n is a terrible variable name! &lt;/i&gt;I used it simply to conform to the question and make it easier for people who are struggling to understand the logic to link it to the question. I can not stress enough the need for proper, logical, understandable, and valuable variable names. These little things can make or break the readability, and by extension the&amp;nbsp;maintainability, of your code.&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Until next time...&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7701864143013799502?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7701864143013799502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7701864143013799502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7701864143013799502'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-14.html' title='Project Euler - Problem 14'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-4054355925267624647</id><published>2011-06-19T12:01:00.013+02:00</published><updated>2011-06-19T12:01:01.120+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 13</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 13 of my Project Euler series.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 13&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;Find the first ten digits of the sum of one-hundred 50-digit numbers.&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.&lt;br /&gt;&lt;br /&gt;37107287533902102798797998220837590246510135740250&lt;br /&gt;46376937677490009712648124896970078050417018260538&lt;br /&gt;74324986199524741059474233309513058123726617309629&lt;br /&gt;91942213363574161572522430563301811072406154908250&lt;br /&gt;23067588207539346171171980310421047513778063246676&lt;br /&gt;89261670696623633820136378418383684178734361726757&lt;br /&gt;28112879812849979408065481931592621691275889832738&lt;br /&gt;44274228917432520321923589422876796487670272189318&lt;br /&gt;47451445736001306439091167216856844588711603153276&lt;br /&gt;70386486105843025439939619828917593665686757934951&lt;br /&gt;62176457141856560629502157223196586755079324193331&lt;br /&gt;64906352462741904929101432445813822663347944758178&lt;br /&gt;92575867718337217661963751590579239728245598838407&lt;br /&gt;58203565325359399008402633568948830189458628227828&lt;br /&gt;80181199384826282014278194139940567587151170094390&lt;br /&gt;35398664372827112653829987240784473053190104293586&lt;br /&gt;86515506006295864861532075273371959191420517255829&lt;br /&gt;71693888707715466499115593487603532921714970056938&lt;br /&gt;54370070576826684624621495650076471787294438377604&lt;br /&gt;53282654108756828443191190634694037855217779295145&lt;br /&gt;36123272525000296071075082563815656710885258350721&lt;br /&gt;45876576172410976447339110607218265236877223636045&lt;br /&gt;17423706905851860660448207621209813287860733969412&lt;br /&gt;81142660418086830619328460811191061556940512689692&lt;br /&gt;51934325451728388641918047049293215058642563049483&lt;br /&gt;62467221648435076201727918039944693004732956340691&lt;br /&gt;15732444386908125794514089057706229429197107928209&lt;br /&gt;55037687525678773091862540744969844508330393682126&lt;br /&gt;18336384825330154686196124348767681297534375946515&lt;br /&gt;80386287592878490201521685554828717201219257766954&lt;br /&gt;78182833757993103614740356856449095527097864797581&lt;br /&gt;16726320100436897842553539920931837441497806860984&lt;br /&gt;48403098129077791799088218795327364475675590848030&lt;br /&gt;87086987551392711854517078544161852424320693150332&lt;br /&gt;59959406895756536782107074926966537676326235447210&lt;br /&gt;69793950679652694742597709739166693763042633987085&lt;br /&gt;41052684708299085211399427365734116182760315001271&lt;br /&gt;65378607361501080857009149939512557028198746004375&lt;br /&gt;35829035317434717326932123578154982629742552737307&lt;br /&gt;94953759765105305946966067683156574377167401875275&lt;br /&gt;88902802571733229619176668713819931811048770190271&lt;br /&gt;25267680276078003013678680992525463401061632866526&lt;br /&gt;36270218540497705585629946580636237993140746255962&lt;br /&gt;24074486908231174977792365466257246923322810917141&lt;br /&gt;91430288197103288597806669760892938638285025333403&lt;br /&gt;34413065578016127815921815005561868836468420090470&lt;br /&gt;23053081172816430487623791969842487255036638784583&lt;br /&gt;11487696932154902810424020138335124462181441773470&lt;br /&gt;63783299490636259666498587618221225225512486764533&lt;br /&gt;67720186971698544312419572409913959008952310058822&lt;br /&gt;95548255300263520781532296796249481641953868218774&lt;br /&gt;76085327132285723110424803456124867697064507995236&lt;br /&gt;37774242535411291684276865538926205024910326572967&lt;br /&gt;23701913275725675285653248258265463092207058596522&lt;br /&gt;29798860272258331913126375147341994889534765745501&lt;br /&gt;18495701454879288984856827726077713721403798879715&lt;br /&gt;38298203783031473527721580348144513491373226651381&lt;br /&gt;34829543829199918180278916522431027392251122869539&lt;br /&gt;40957953066405232632538044100059654939159879593635&lt;br /&gt;29746152185502371307642255121183693803580388584903&lt;br /&gt;41698116222072977186158236678424689157993532961922&lt;br /&gt;62467957194401269043877107275048102390895523597457&lt;br /&gt;23189706772547915061505504953922979530901129967519&lt;br /&gt;86188088225875314529584099251203829009407770775672&lt;br /&gt;11306739708304724483816533873502340845647058077308&lt;br /&gt;82959174767140363198008187129011875491310547126581&lt;br /&gt;97623331044818386269515456334926366572897563400500&lt;br /&gt;42846280183517070527831839425882145521227251250327&lt;br /&gt;55121603546981200581762165212827652751691296897789&lt;br /&gt;32238195734329339946437501907836945765883352399886&lt;br /&gt;75506164965184775180738168837861091527357929701337&lt;br /&gt;62177842752192623401942399639168044983993173312731&lt;br /&gt;32924185707147349566916674687634660915035914677504&lt;br /&gt;99518671430235219628894890102423325116913619626622&lt;br /&gt;73267460800591547471830798392868535206946944540724&lt;br /&gt;76841822524674417161514036427982273348055556214818&lt;br /&gt;97142617910342598647204516893989422179826088076852&lt;br /&gt;87783646182799346313767754307809363333018982642090&lt;br /&gt;10848802521674670883215120185883543223812876952786&lt;br /&gt;71329612474782464538636993009049310363619763878039&lt;br /&gt;62184073572399794223406235393808339651327408011116&lt;br /&gt;66627891981488087797941876876144230030984490851411&lt;br /&gt;60661826293682836764744779239180335110989069790714&lt;br /&gt;85786944089552990653640447425576083659976645795096&lt;br /&gt;66024396409905389607120198219976047599490197230297&lt;br /&gt;64913982680032973156037120041377903785566085089252&lt;br /&gt;16730939319872750275468906903707539413042652315011&lt;br /&gt;94809377245048795150954100921645863754710598436791&lt;br /&gt;78639167021187492431995700641917969777599028300699&lt;br /&gt;15368713711936614952811305876380278410754449733078&lt;br /&gt;40789923115535562561142322423255033685442488917353&lt;br /&gt;44889911501440648020369068063960672322193204149535&lt;br /&gt;41503128880339536053299340368006977710650566631954&lt;br /&gt;81234880673210146739058568557934581403627822703280&lt;br /&gt;82616570773948327592232845941706525094512325230608&lt;br /&gt;22918802058777319719839450180888072429661980811197&lt;br /&gt;77158542502016545090413245809786882778948721859617&lt;br /&gt;72107838435069186155435662884062257473692284509516&lt;br /&gt;20849603980134001723930671666823555245252804609722&lt;br /&gt;53503534226472524250874054075591789781264330331690&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Find the first ten digits of the sum of one-hundred 50-digit numbers.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0013&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;var numbers = GetInput();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;var list = from num in numbers&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;select double.Parse(num.Insert(25, "."));&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;var sum = list.Sum();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;string answer = sum.ToString().Replace(".", "").Substring(0, 11);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.WriteLine(answer);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static string[] GetInput()&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return @"37107287533902102798797998220837590246510135740250&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;46376937677490009712648124896970078050417018260538&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;74324986199524741059474233309513058123726617309629&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;91942213363574161572522430563301811072406154908250&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;23067588207539346171171980310421047513778063246676&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;89261670696623633820136378418383684178734361726757&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;28112879812849979408065481931592621691275889832738&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;44274228917432520321923589422876796487670272189318&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;47451445736001306439091167216856844588711603153276&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;70386486105843025439939619828917593665686757934951&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;62176457141856560629502157223196586755079324193331&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;64906352462741904929101432445813822663347944758178&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;92575867718337217661963751590579239728245598838407&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;58203565325359399008402633568948830189458628227828&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;80181199384826282014278194139940567587151170094390&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;35398664372827112653829987240784473053190104293586&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;86515506006295864861532075273371959191420517255829&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;71693888707715466499115593487603532921714970056938&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;54370070576826684624621495650076471787294438377604&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;53282654108756828443191190634694037855217779295145&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;36123272525000296071075082563815656710885258350721&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;45876576172410976447339110607218265236877223636045&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;17423706905851860660448207621209813287860733969412&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;81142660418086830619328460811191061556940512689692&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;51934325451728388641918047049293215058642563049483&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;62467221648435076201727918039944693004732956340691&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;15732444386908125794514089057706229429197107928209&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;55037687525678773091862540744969844508330393682126&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;18336384825330154686196124348767681297534375946515&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;80386287592878490201521685554828717201219257766954&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;78182833757993103614740356856449095527097864797581&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;16726320100436897842553539920931837441497806860984&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;48403098129077791799088218795327364475675590848030&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;87086987551392711854517078544161852424320693150332&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;59959406895756536782107074926966537676326235447210&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;69793950679652694742597709739166693763042633987085&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;41052684708299085211399427365734116182760315001271&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;65378607361501080857009149939512557028198746004375&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;35829035317434717326932123578154982629742552737307&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;94953759765105305946966067683156574377167401875275&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;88902802571733229619176668713819931811048770190271&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;25267680276078003013678680992525463401061632866526&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;36270218540497705585629946580636237993140746255962&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;24074486908231174977792365466257246923322810917141&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;91430288197103288597806669760892938638285025333403&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;34413065578016127815921815005561868836468420090470&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;23053081172816430487623791969842487255036638784583&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;11487696932154902810424020138335124462181441773470&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;63783299490636259666498587618221225225512486764533&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;67720186971698544312419572409913959008952310058822&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;95548255300263520781532296796249481641953868218774&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;76085327132285723110424803456124867697064507995236&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;37774242535411291684276865538926205024910326572967&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;23701913275725675285653248258265463092207058596522&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;29798860272258331913126375147341994889534765745501&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;18495701454879288984856827726077713721403798879715&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;38298203783031473527721580348144513491373226651381&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;34829543829199918180278916522431027392251122869539&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;40957953066405232632538044100059654939159879593635&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;29746152185502371307642255121183693803580388584903&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;41698116222072977186158236678424689157993532961922&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;62467957194401269043877107275048102390895523597457&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;23189706772547915061505504953922979530901129967519&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;86188088225875314529584099251203829009407770775672&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;11306739708304724483816533873502340845647058077308&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;82959174767140363198008187129011875491310547126581&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;97623331044818386269515456334926366572897563400500&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;42846280183517070527831839425882145521227251250327&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;55121603546981200581762165212827652751691296897789&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;32238195734329339946437501907836945765883352399886&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;75506164965184775180738168837861091527357929701337&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;62177842752192623401942399639168044983993173312731&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;32924185707147349566916674687634660915035914677504&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;99518671430235219628894890102423325116913619626622&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;73267460800591547471830798392868535206946944540724&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;76841822524674417161514036427982273348055556214818&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;97142617910342598647204516893989422179826088076852&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;87783646182799346313767754307809363333018982642090&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;10848802521674670883215120185883543223812876952786&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;71329612474782464538636993009049310363619763878039&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;62184073572399794223406235393808339651327408011116&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;66627891981488087797941876876144230030984490851411&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;60661826293682836764744779239180335110989069790714&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;85786944089552990653640447425576083659976645795096&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;66024396409905389607120198219976047599490197230297&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;64913982680032973156037120041377903785566085089252&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;16730939319872750275468906903707539413042652315011&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;94809377245048795150954100921645863754710598436791&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;78639167021187492431995700641917969777599028300699&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;15368713711936614952811305876380278410754449733078&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;40789923115535562561142322423255033685442488917353&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;44889911501440648020369068063960672322193204149535&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;41503128880339536053299340368006977710650566631954&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;81234880673210146739058568557934581403627822703280&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;82616570773948327592232845941706525094512325230608&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;22918802058777319719839450180888072429661980811197&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;77158542502016545090413245809786882778948721859617&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;72107838435069186155435662884062257473692284509516&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;20849603980134001723930671666823555245252804609722&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;53503534226472524250874054075591789781264330331690".Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;As&amp;nbsp;imposing&amp;nbsp;as this one looks, it is really not that bad at all. Granted if I would have been using .NET Framework 4.0 it would have been extremely easy. &amp;nbsp;In .NET 4.0 they decided to implement a new number type called BigInteger. That would have allowed me to simply add the numbers together and find the part that I wanted as if it were any other supported data type. Since I am using .NET Framework 3.5 I was without this ability so it took a little more work. &amp;nbsp;Not a lot though.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Even without BigInteger I was able to let the framework do the work for me. It was through a&amp;nbsp;nuance&amp;nbsp;that programming makes available to us. I&amp;nbsp;converted&amp;nbsp;these seemingly clear integers into doubles. I placed a decimal after the first 25 numbers, thereby "shrinking" the number down to usable size. I summed the list of "doubles" and took the part required by the problem. &amp;nbsp;Since we are dealing with addition here it didn't change the answer in the least if it was split in half by a decimal point, completely behind the decimal point, or left as an integer. &amp;nbsp;Sometimes it really pays off to take a step back and think before letting your fingers start coding.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Until next time...&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-4054355925267624647?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/4054355925267624647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-13.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4054355925267624647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4054355925267624647'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-13.html' title='Project Euler - Problem 13'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7296616127748111857</id><published>2011-06-12T12:01:00.001+02:00</published><updated>2011-06-12T12:01:00.933+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 12</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 12 of my Project Euler series.&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 12&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;What is the value of the first triangle number to have over five hundred divisors?&lt;br /&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&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;br /&gt;&lt;br /&gt;1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...&lt;br /&gt;&lt;br /&gt;Let us list the factors of the first seven triangle numbers:&lt;br /&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;&lt;br /&gt;We can see that 28 is the first triangle number to have over five divisors.&lt;br /&gt;&lt;br /&gt;What is the value of the first triangle number to have over five hundred divisors?&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;//&amp;nbsp;What is the value of the first triangle number to have over five hundred divisors?&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0012&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int triangleNumber = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int factors = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int counter = 1;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;while (factors &amp;lt;= 500)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;factors = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;triangleNumber += counter;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;for (int i = 1; i &amp;lt; (int)Math.Sqrt(triangleNumber); i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (triangleNumber % i == 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;factors+=2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;counter++;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Write(triangleNumber);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This one is a pretty easy brute force solution. &amp;nbsp;Go through all the&amp;nbsp;triangle&amp;nbsp;numbers starting at one and see how many factors they have. If it is more than 500 then we have a winner. &amp;nbsp;Print and finished. The method needed to solve this one is given right in the details. It can be improved though. Because of the size of the numbers that we are working with here, I decided to apply one small bit of optimization just to spice things up.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This optimization that I&amp;nbsp;applied&amp;nbsp;was not a programmatic one, but rather a mathematical&amp;nbsp;subtlety&amp;nbsp;that I happened to remember. &amp;nbsp;If you add two to the factor count, you only have to go up to the square root. This works because it is not asking what the factors are, but rather just for the count. After the square root, you are just going to be going through the other side of the list. I went ahead and skipped that list in&amp;nbsp;lieu&amp;nbsp;of using this shortcut.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Until next time...&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7296616127748111857?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7296616127748111857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7296616127748111857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7296616127748111857'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-12.html' title='Project Euler - Problem 12'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-354294289712418320</id><published>2011-06-06T12:01:00.001+02:00</published><updated>2011-06-06T12:01:00.960+02:00</updated><title type='text'>Updates to code base</title><content type='html'>I am going to be uploading the code to a &lt;a href="http://code.google.com/p/adkins-project-euler/"&gt;project &lt;/a&gt;that I have started with Google Code (as I mentioned &lt;a href="http://blog.adkins-software.com/2011/05/project-euler-souce-code-on-google-code.html"&gt;here&lt;/a&gt;) but I have not found a way that I can schedule the upload with the publishing of my blog posts so expect delays. I will try and get it done within a day or two of the publishing of the posts, but since a lot of those are written ahead of time and scheduled, I can't promise much. Just keep checking back and it will be there. &amp;nbsp;That I promise.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-354294289712418320?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/354294289712418320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/updates-to-code-base.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/354294289712418320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/354294289712418320'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/updates-to-code-base.html' title='Updates to code base'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8198855460420474773</id><published>2011-06-05T12:01:00.001+02:00</published><updated>2011-06-05T12:01:00.305+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 11</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 11 of my Project Euler series.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 11&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;What is the greatest product of four numbers on the same straight line in the 20 by 20 grid?&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;In the 20&lt;img border="0" src="http://projecteuler.net/images/symbol_times.gif" /&gt;20 grid below, four numbers along a diagonal line have been marked in red.&lt;div&gt;&lt;br /&gt;&lt;div style="font-family: 'courier new'; font-size: 10pt; text-align: center;"&gt;08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08&lt;br /&gt;49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00&lt;br /&gt;81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65&lt;br /&gt;52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91&lt;br /&gt;22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80&lt;br /&gt;24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50&lt;br /&gt;32 98 81 28 64 23 67 10&amp;nbsp;&lt;span style="color: red;"&gt;&lt;b&gt;26&lt;/b&gt;&lt;/span&gt;&amp;nbsp;38 40 67 59 54 70 66 18 38 64 70&lt;br /&gt;67 26 20 68 02 62 12 20 95&amp;nbsp;&lt;span style="color: red;"&gt;&lt;b&gt;63&lt;/b&gt;&lt;/span&gt;&amp;nbsp;94 39 63 08 40 91 66 49 94 21&lt;br /&gt;24 55 58 05 66 73 99 26 97 17&amp;nbsp;&lt;span style="color: red;"&gt;&lt;b&gt;78&lt;/b&gt;&lt;/span&gt;&amp;nbsp;78 96 83 14 88 34 89 63 72&lt;br /&gt;21 36 23 09 75 00 76 44 20 45 35&amp;nbsp;&lt;span style="color: red;"&gt;&lt;b&gt;14&lt;/b&gt;&lt;/span&gt;&amp;nbsp;00 61 33 97 34 31 33 95&lt;br /&gt;78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92&lt;br /&gt;16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57&lt;br /&gt;86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58&lt;br /&gt;19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40&lt;br /&gt;04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66&lt;br /&gt;88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69&lt;br /&gt;04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36&lt;br /&gt;20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16&lt;br /&gt;20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54&lt;br /&gt;01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48&lt;/div&gt;&lt;br /&gt;The product of these numbers is 26 &lt;img border="0" src="http://projecteuler.net/images/symbol_times.gif" /&gt; 63 &lt;img border="0" src="http://projecteuler.net/images/symbol_times.gif" /&gt; 78 &lt;img border="0" src="http://projecteuler.net/images/symbol_times.gif" /&gt; 14 = 1788696.&lt;br /&gt;&lt;br /&gt;What is the greatest product of four adjacent numbers in any direction (up, down, left, right, or diagonally) in the 20&lt;img border="0" src="http://projecteuler.net/images/symbol_times.gif" /&gt;20 grid?&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// What is the greatest product of four numbers on the same straight line in the 20 by 20 grid?&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0011&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int[,] numbers = LoadNumbers();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int topProduct = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 0; i &amp;lt; 20; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;for (int j = 0; j &amp;lt; 20; j++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;int rightProduct = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;int downProduct = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;int&amp;nbsp;leftDownProduct&amp;nbsp;= 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;int rightDownProduct = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (j + 3 &amp;lt; 20)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;downProduct = numbers[i, j] * numbers[i, j + 1] * numbers[i, j + 2] * numbers[i, j + 3];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;if (i + 3 &amp;lt; 20)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;rightProduct = numbers[i, j] * numbers[i + 1, j] * numbers[i + 2, j] * numbers[i + 3, j];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;rightDownProduct&amp;nbsp;= numbers[i, j] * numbers[i + 1, j + 1] * numbers[i + 2, j + 2] * numbers[i + 3, j + 3];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;if ((i - 3 &amp;lt; 20) &amp;amp;&amp;amp; (i-3 &amp;gt;= 0))&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;leftDownProduct&amp;nbsp;= numbers[i, j] * numbers[i - 1, j + 1] * numbers[i - 2, j + 2] * numbers[i - 3, j + 3];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (rightProduct&amp;nbsp;&amp;gt; topProduct)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;topProduct =&amp;nbsp;rightProduct;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (downProduct &amp;gt; topProduct)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;topProduct = downProduct;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (rightDownProduct&amp;nbsp;&amp;gt; topProduct)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;topProduct =&amp;nbsp;rightDownProduct;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (leftDownProduct&amp;nbsp;&amp;gt; topProduct)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;topProduct =&amp;nbsp;leftDownProduct;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Write(topProduct);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static int[,] LoadNumbers()&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return new int[20,20]&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{{08, 02, 22, 97, 38, 15, 00, 40, 00, 75, 04, 05, 07, 78, 52, 12, 50, 77, 91, 08},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 04, 56, 62, 00},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 03, 49, 13, 36, 65},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{52, 70, 95, 23, 04, 60, 11, 42, 69, 24, 68, 56, 01, 32, 56, 71, 37, 02, 36, 91},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{24, 47, 32, 60, 99, 03, 45, 02, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{67, 26, 20, 68, 02, 62, 12, 20, 95, 63, 94, 39, 63, 08, 40, 91, 66, 49, 94, 21},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{24, 55, 58, 05, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{21, 36, 23, 09, 75, 00, 76, 44, 20, 45, 35, 14, 00, 61, 33, 97, 34, 31, 33, 95},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 03, 80, 04, 62, 16, 14, 09, 53, 56, 92},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{16, 39, 05, 42, 96, 35, 31, 47, 55, 58, 88, 24, 00, 17, 54, 24, 36, 29, 85, 57},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{86, 56, 00, 48, 35, 71, 89, 07, 05, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{19, 80, 81, 68, 05, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 04, 89, 55, 40},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{04, 52, 08, 83, 97, 35, 99, 16, 07, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{88, 36, 68, 87, 57, 62, 20, 72, 03, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{04, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 08, 46, 29, 32, 40, 62, 76, 36},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 04, 36, 16},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{20, 73, 35, 29, 78, 31, 90, 01, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 05, 54},&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{01, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 01, 89, 19, 67, 48}};&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;In this problem there are a total of eight directions that one could take from a given number in a straight line to find the sum. With a bit of cleaver thinking though, you will notice that you only need to check 4. That will cover the rest of them automatically. &amp;nbsp;I have chose to go with right from the number, right and down, down, and left and down. &amp;nbsp;Just as easily you could have used left instead of right and up instead of down, but that is all just a random choice that was made on my part. &amp;nbsp;I chose down since I was starting my search in the top left corner and I chose right for the same reason. I suppose it would be possible (although slightly more confusing) to start in the bottom right and then use right and up, but I digress.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I found my position in the table by using nested 'for' statements. &amp;nbsp;This allowed me to proceed through one complete column before I moved on to the next (iterate through 'j' completely before incrementing 'i'). &amp;nbsp;This i,j combination was used in essence as a grid system for this problem.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Starting in the top left I first check if I can in fact go 3 down from my current&amp;nbsp;position. &amp;nbsp;If so then I get the product for that line of characters. &amp;nbsp;Doing this means that I don't have to check four numbers in a row going up from the number at the end of the line. That would produce the same product. &amp;nbsp;I then do the same check and calculation to the right. &amp;nbsp;Since I chose the directions to match up to where I was starting this is of course a bit of a wasted effort for the first several checks, but near the end of the row, and the end of the list it starts to pay off.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;At the end of each round of checks for each number, I simply checked the values against the current top value that I had. Naturally, if it was bigger than the top, it took top honors. &amp;nbsp;At the end, as always, print and submit. It is really that easy!&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The next two problems are going to look like simple brute force answers, but really there is a level of&amp;nbsp;subtlety&amp;nbsp;that needs to be applied to them, but I will talk more about those in the coming weeks. &amp;nbsp;Until next time...&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8198855460420474773?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8198855460420474773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-11.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8198855460420474773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8198855460420474773'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/project-euler-problem-11.html' title='Project Euler - Problem 11'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7594733295780651868</id><published>2011-06-01T18:30:00.022+02:00</published><updated>2011-06-01T18:30:00.888+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming Tips'/><title type='text'>Research can be better than knowledge.</title><content type='html'>The problem from this week for my &lt;a href="http://blog.adkins-software.com/2011/05/project-euler-problem-10.html"&gt;Project Euler series&lt;/a&gt; was something that I was not&amp;nbsp;immediately&amp;nbsp;aware how to answer. &amp;nbsp;Let's just say it has been a little while since I took my last math course, and doing up the house hold budget doesn't involve a lot of searching for the sum of primes, nor does it have anything to do with numbers in the millions. I was out of my league on this one. I needed help. I hit the net and did some research into various techniques of summing primes.&lt;br /&gt;&lt;br /&gt;This is important enough to warrant it's own post because I think this is an insanely important thing to know for programming.&amp;nbsp;No one&amp;nbsp;is going to know everything that there is to know about anything. It just isn't possible. &amp;nbsp;More important (at least in my eyes) is the ability to research &lt;u&gt;and comprehend&lt;/u&gt;&amp;nbsp;what you don't know in a timely fashion. &amp;nbsp;I stressed the comprehend part of that because it doesn't help out, in the long run, if you simply search for an answer on a website (or an amazing blog), copy and paste the code into your own project, and give the answer to the &lt;a href="http://projecteuler.net/"&gt;Project Euler&lt;/a&gt; website. Sure, it will make you feel good about having a large number of solutions on your cool little icon, but that is about the extent of what you will get out of it. If you comprehend it, however, you will be able to retain a bit of it in the back of your mind, and you will have a much greater chance of recalling it next time something like that comes up.&lt;br /&gt;&lt;br /&gt;This doesn't just apply to the Project Euler problems either. This can be&amp;nbsp;applied&amp;nbsp;to anything. If you come&amp;nbsp;across&amp;nbsp;something in your programming journey that you just don't know how to do,&amp;nbsp;embrace&amp;nbsp;the&amp;nbsp;opportunity. &amp;nbsp;Take some time, whatever time you can, and look into the topic. &amp;nbsp;Dig a little deeper than just the answer to your immediate problem. &amp;nbsp;Find the answer to greater questions.&lt;br /&gt;&lt;br /&gt;Also don't get stuck. This can vary easily get out of had. In addition to looking into, comprehending, and retaining answers, you also need to know when to call it good enough and move on. &amp;nbsp;Your boss will hopefully be able to appreciate you expanding your knowledge base to some extent, but if you expand it to the point of neglecting your work, his views might change slightly. &amp;nbsp;Getting an understanding of a topic is different than researching the topic for your PhD thesis.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7594733295780651868?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7594733295780651868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/06/research-can-be-better-than-knowledge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7594733295780651868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7594733295780651868'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/06/research-can-be-better-than-knowledge.html' title='Research can be better than knowledge.'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-171644494707571206</id><published>2011-05-31T18:30:00.000+02:00</published><updated>2011-05-31T18:30:02.259+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Open Source Projects'/><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler souce code on Google Code</title><content type='html'>This is just a quick note that I have created a project hosted by Google Code for all the source code that has been given out for my Project Euler series. &amp;nbsp;It is called &lt;a href="http://code.google.com/p/adkins-project-euler"&gt;adkins-project-euler&lt;/a&gt;. It is open source and just waiting for someone to come in and look it over. If you want to join the project and give some input about the code I would be more than happy to accept you into it, even though I would ask that you limit to discussing changes to the code instead of just making them (simply so I can keep the blog up to date with the changes in the code).&lt;br /&gt;&lt;br /&gt;As of right now I have just dumped my local project on the server, but I am going to be going through and cutting it back to just the problems that were included in the blog so far. &amp;nbsp;A little added bonus that I think I will leave is some other implementations that I have done for a couple of projects. &amp;nbsp;There was a game going on at one of the forums that I frequent (&lt;a href="http://www.dreamincode.net/"&gt;Dream.In.Code&lt;/a&gt;) called Code Golf. The point was to solve the given problem with as few characters as possible. I didn't do the best, but I wasn't the worst either.&lt;br /&gt;&lt;br /&gt;Without any further babbling, go check it out and let me know what you think.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-171644494707571206?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/171644494707571206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-souce-code-on-google-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/171644494707571206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/171644494707571206'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-souce-code-on-google-code.html' title='Project Euler souce code on Google Code'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-5114584367919202709</id><published>2011-05-29T12:01:00.000+02:00</published><updated>2011-05-29T12:01:00.497+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 10</title><content type='html'>Welcome to week 10 of my Project Euler series.&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 10&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;Calculate the sum of all the primes below two million.&lt;br /&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.&lt;br /&gt;&lt;br /&gt;Find the sum of all the primes below two million.&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Calculate the sum of all the primes below two million.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Project0010&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;var numbers = SieveEratosthenes(2000000);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;long total = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;foreach (var num in numbers)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;total += num;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Write(total);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;// Sieve of Eratosthenes&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public static int[] SieveEratosthenes(int upperLimit)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int sieveBound = (int)(upperLimit - 1) / 2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int upperSqrt = ((int)Math.Sqrt(upperLimit) - 1) / 2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;BitArray PrimeBits = new BitArray(sieveBound + 1, true);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 1; i &amp;lt;= upperSqrt; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if (PrimeBits.Get(i))&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;for (int j = i * 2 * (i + 1); j &amp;lt;= sieveBound; j += 2 * i + 1)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;PrimeBits.Set(j, false);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;List&lt;int&gt; numbers = new List&lt;int&gt;((int)(upperLimit / (Math.Log(upperLimit) - 1.08366)));&lt;/int&gt;&lt;/int&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;numbers.Add(2);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 1; i &amp;lt;= sieveBound; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if (PrimeBits.Get(i))&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;numbers.Add(2 * i + 1);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return numbers.ToArray();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This one certainly had me thinking and even doing a bit of research. &amp;nbsp;It is possible to brute force your way through it, but the problem is that Project Euler explicitly states that each problem can be solved by a moderate computer in under a minute. After the brute force route had run for about 5 minutes I decided that another approach was needed. &amp;nbsp;Since it has been a while since I had a math course I hit the web and did some searching. &amp;nbsp;I checked into different algorithms for working with primes and&amp;nbsp;particularly with the sum of primes. One name that kept popping up was "Sieve of Eratosthenes." &amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes"&gt;Wikipedia &lt;/a&gt;describes the Sieve so - "In mathematics, the Sieve of Eratosthenes (Greek: κόσκινον Ἐρατοσθένους) is a simple, ancient algorithm for finding all prime numbers up to a specified integer. It works efficiently for the smaller primes (below 10 million)." It goes on to give a great description of how it works with a nice animation to really help drive the point home. &amp;nbsp;The general idea behind it is that if 2 is a prime, then all multiples of 2 can not be. &amp;nbsp;By eliminating all of those from the list of numbers that is being searched the field narrows itself relatively quickly. &amp;nbsp;This is done until you reach the square root of the number that you are looking for. &amp;nbsp;Once you get past the Square Root of the maximum number that you are looking for then it is safe to assume that all the primes have been found. &amp;nbsp;This is more of an optimization step, but it is still one that can be taken if you want. &amp;nbsp;It can even be taken one step further by starting the elimination of numbers with the square of the prime that you found, since it has been proven that all numbers between the prime you found and it's square should already be crossed out by process of elimination. &amp;nbsp;It really is quite the interesting piece of&amp;nbsp;mathematical&amp;nbsp;info to have.&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I have recreated this by first creating an array with the number of elements being equal to the number that I am searching to. It is a BitArray to minimize the overhead and speed up the whole process. I go through this list to decide if a number is prime or not (true or false). &amp;nbsp;At the end I translate this list from simple set or not set values to actual numbers. &amp;nbsp;Send this back as a return value and some addition later I have my answer.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Just as a side note, it is possible to start your Sieve with the number three and then bump up your iterator by two each pass to improve the performance even more. &amp;nbsp;This is possible because the first round of eliminations will automatically knock out each even number so there is no need to even check them.&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-5114584367919202709?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/5114584367919202709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5114584367919202709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5114584367919202709'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-10.html' title='Project Euler - Problem 10'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-5354803798751534303</id><published>2011-05-26T09:59:00.000+02:00</published><updated>2011-05-26T09:59:42.222+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Wix Standardizer'/><category scheme='http://www.blogger.com/atom/ns#' term='Open Source Projects'/><title type='text'>New WiX open source project</title><content type='html'>I have started doing a series of tutorials for a forum that I tend to frequent (&lt;a href="http://dreamincode.net/"&gt;Dream-In-Code.net&lt;/a&gt;) about the Windows Installer XML toolkit (WiX). &amp;nbsp;It is a toolset that allows you to make MSI's (Windows Installer Packets) using just XML, a linker, and a compiler. Pretty neat stuff.&lt;br /&gt;&lt;br /&gt;I have decided in my spare time to start an open source project that is going to work as a standardization tool that can be used to, you guessed it, standardize a large number of WiX source files. &amp;nbsp;I short the plan is that it will take certain settings (either through the GUI or a settings XML) and apply the changes to all listed WXS files. &amp;nbsp;This is going to be completely useless to people who only have one or two files, but if more WXS files are involved it could really help out.&lt;br /&gt;&lt;br /&gt;So far I have started a project with &lt;a href="http://code.google.com/p/wix-standardizer/"&gt;Google Code&lt;/a&gt;&amp;nbsp;and checked in the first couple of dummy files to show the basic idea of how the project will be set up. &amp;nbsp;I have also started working on the Schema that will be used for the settings file, and will whip up a quick settings parser as soon as I am happy with the schema. &amp;nbsp;Anyone who wants to help out is more than welcome to do so; you just have to send me a quick mail and I will add you to the project.&lt;br /&gt;&lt;br /&gt;Until next time,&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-5354803798751534303?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/5354803798751534303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/new-wix-open-source-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5354803798751534303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5354803798751534303'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/new-wix-open-source-project.html' title='New WiX open source project'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-5134669795547361895</id><published>2011-05-22T12:01:00.001+02:00</published><updated>2011-05-22T12:01:00.275+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 9</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 9 of my Project Euler series.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 9&lt;/u&gt;:&lt;/div&gt;Find the only Pythagorean triplet, {a, b, c}, for which a + b+ c = 1000.&lt;br /&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;/div&gt;A Pythagorean triplet is a set of three natural numbers, a &lt;img border="0" src="http://projecteuler.net/images/symbol_lt.gif" /&gt; b &lt;img border="0" src="http://projecteuler.net/images/symbol_lt.gif" /&gt; c, for which,&lt;br /&gt;a2 + b2 = c2&lt;br /&gt;&lt;br /&gt;For example, 32 + 42 = 9 + 16 = 25 = 52.&lt;br /&gt;&lt;br /&gt;There exists exactly one Pythagorean triplet for which a + b + c = 1000.&lt;br /&gt;Find the product abc.&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0009&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int answer = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int a = 1; a &amp;lt; 500; a++) // a + b + c = 1000 so a and b can not be more than 500&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;for (int b = a; b &amp;lt; 500; b++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;int c = 1000 - a - b;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if ((a * a) + (b * b) == (c * c))&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;answer = a * b * c;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;break;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if (answer &amp;gt; 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;break;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Write(answer);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.ReadLine();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This one was once again pretty simple (I am really going to miss being able to say that in a couple of weeks). &amp;nbsp;The details do an&amp;nbsp;adequate&amp;nbsp;job of explaining a&amp;nbsp;Pythagorean&amp;nbsp;triplet so there is no need to reiterate that here, but one thing that will make life easier is keeping in mind that the sum of the three numbers has to be 1000. &amp;nbsp;That allowed me to shrink my for statement down to only include numbers less than (exclusive) 500. I could have in all honesty shrunk it down quite a bit further, but finding that fine line was not really worth the effort. There was no chance that one of the numbers could be over 500 since 'b' has to be bigger than 'a' and there sum has to be 1000.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Once getting a grip on that and putting my two for statements in place I just go ahead and figure out what 'c' would be given the other two numbers and check if they are in fact a Pythagorean triplet. &amp;nbsp;If they are I have my answer and since it is explicitly stated in the problem that there is only one I went ahead and added a break in. No point in searching for an answer that I already have.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Next week is going to get a bit tricky to be honest so make sure and check it out. &amp;nbsp;Until next time...&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-5134669795547361895?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/5134669795547361895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-9.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5134669795547361895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5134669795547361895'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-9.html' title='Project Euler - Problem 9'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-3036540021083835311</id><published>2011-05-15T12:01:00.003+02:00</published><updated>2011-05-15T12:01:00.163+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 8</title><content type='html'>Welcome to week 8 of my Project Euler series.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Problem 8&lt;/u&gt;:&lt;br /&gt;Discover the largest product of five consecutive digits in the 1000-digit number.&lt;br /&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;u&gt;Details&lt;/u&gt;:&lt;br /&gt;&lt;div style="font-family: 'Trebuchet MS', sans-serif; font-size: 16px;"&gt;Find the greatest product of five consecutive digits in the 1000-digit number.&lt;/div&gt;&lt;div style="font-family: 'courier new'; font-size: 10pt; text-align: center;"&gt;73167176531330624919225119674426574742355349194934&lt;br /&gt;96983520312774506326239578318016984801869478851843&lt;br /&gt;85861560789112949495459501737958331952853208805511&lt;br /&gt;12540698747158523863050715693290963295227443043557&lt;br /&gt;66896648950445244523161731856403098711121722383113&lt;br /&gt;62229893423380308135336276614282806444486645238749&lt;br /&gt;30358907296290491560440772390713810515859307960866&lt;br /&gt;70172427121883998797908792274921901699720888093776&lt;br /&gt;65727333001053367881220235421809751254540594752243&lt;br /&gt;52584907711670556013604839586446706324415722155397&lt;br /&gt;53697817977846174064955149290862569321978468622482&lt;br /&gt;83972241375657056057490261407972968652414535100474&lt;br /&gt;82166370484403199890008895243450658541227588666881&lt;br /&gt;16427171479924442928230863465674813919123162824586&lt;br /&gt;17866458359124566529476545682848912883142607690042&lt;br /&gt;24219022671055626321111109370544217506941658960408&lt;br /&gt;07198403850962455444362981230987879927244284909188&lt;br /&gt;84580156166097919133875499200524063689912560717606&lt;br /&gt;05886116467109405077541002256983155200055935729725&lt;br /&gt;71636269561882670428252483600823257530420752963450&lt;/div&gt;&lt;br /&gt;&lt;u&gt;Code&lt;/u&gt;:&lt;br /&gt;// Discover the largest product of five consecutive digits in the (given) 1000-digit number.&lt;br /&gt;class Problem0008&lt;br /&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;var rawString = LoadString();&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;List&lt;char&gt; characterList = rawString.ToCharArray().ToList();&lt;/char&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;List&lt;int&gt; products = new List&lt;int&gt;();&lt;/int&gt;&lt;/int&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for (int i = 0; i &amp;lt; characterList.Count() - 4; i++)&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;int first = int.Parse(characterList[i].ToString());&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;int second = int.Parse(characterList[i+1].ToString());&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;int third = int.Parse(characterList[i+2].ToString());&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;int fourth = int.Parse(characterList[i+3].ToString());&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;int fifth = int.Parse(characterList[i+4].ToString());&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;products.Add(first * second * third * fourth * fifth);&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.WriteLine(products.Max());&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.Read();&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;private static string LoadString()&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450";&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Solution&lt;/u&gt;:&lt;br /&gt;For starters a little clarification. The number that is given, and subsequently used, is a number, not a list of numbers. It is only written the way it is in the description, and subsequently in my code, for readability purposes.&lt;br /&gt;&lt;br /&gt;This exercise turned out to be more of a raw data practicing exercise than anything else. I simply took all the input as string and converted it into a list of characters ( rawString.ToCharArray().ToList() ). &amp;nbsp;With that done I created on additional list (of integers) that stores all the products that I get as I run through the list. &amp;nbsp;In order to shave off a good 2 or 3 milliseconds I used a for loop that only goes as long as there are enough characters after the fact to warrant it. &amp;nbsp;For each character I place it and the next four into variables and add their product to my list. &amp;nbsp;A simple call to the Max() method of my list and I have my answer. Nothing to it.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-3036540021083835311?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/3036540021083835311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3036540021083835311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3036540021083835311'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-8.html' title='Project Euler - Problem 8'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-5803342254250648766</id><published>2011-05-08T12:01:00.017+02:00</published><updated>2011-05-08T12:01:00.536+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 7</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 7 of Project Euler.&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 7:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;Find the 10001st prime.&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.&lt;br /&gt;&lt;br /&gt;What is the 10001st prime number?&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Find the 10001st prime.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0007&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;List&lt;long&gt; primes = new List&lt;long&gt;();&lt;/long&gt;&lt;/long&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;int number = 2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;while (primes.Count() != 10001)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;bool isPrime = true;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;for (var j = 2; j &amp;lt; number; j++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;if (number % j == 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;isPrime = false;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;break;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if (isPrime)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;primes.Add(number);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;primes.Sort();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;number++;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;primes.Sort();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.WriteLine(primes.Last());&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Console.ReadLine();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This one is pretty similar to &lt;a href="http://blog.adkins-software.com/2011/04/project-euler-problem-3_10.html"&gt;Problem 3&lt;/a&gt;&amp;nbsp;except that instead of making a list of primes of a certain number, we are making a list of primes until the list has a certain number of entries. That, however, is pretty much where the differences end. &amp;nbsp;I start off my search for primes with the number two (one is not technically a prime number) and go from there. I have a list that is collecting all the primes that are found along the journey. &amp;nbsp;As soon as a number is found to not be prime, I break out of that iteration of the loop and try again with the next number. &amp;nbsp;A bool helps me keep track of whether or not it is actually a prime and at the end, if it is, then I add it to my list. &amp;nbsp;At the end all that needs to be done is sort the list and display the last one. &amp;nbsp;Done!&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Up next week will be problem 8 which is another brute force solution. &amp;nbsp;The next prime number problem (number 10 I believe), however, is shaping up to be pretty interesting. Until then...&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-5803342254250648766?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/5803342254250648766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5803342254250648766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5803342254250648766'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-7.html' title='Project Euler - Problem 7'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7183034546314373052</id><published>2011-05-01T12:01:00.004+02:00</published><updated>2011-05-01T12:01:00.642+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 6</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 6 of Project Euler.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 6:&lt;/u&gt;&lt;/div&gt;What is the difference between the sum of the squares and the square of the sums?&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;The sum of the squares of the first ten natural numbers is,&lt;br /&gt;12 + 22 + ... + 102 = 385&lt;br /&gt;&lt;br /&gt;The square of the sum of the first ten natural numbers is,&lt;br /&gt;(1 + 2 + ... + 10)2 = 552 = 3025&lt;br /&gt;&lt;br /&gt;Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 -&amp;nbsp;385 = 2640.&lt;br /&gt;&lt;br /&gt;Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// What is the difference between the sum of the squares and the square of the sums?&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem0006&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int sum = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int sumOfSquares = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = 1; i &amp;lt;= 100; i++)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sum += i;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sumOfSquares += (i * i);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int squareOfSums = (sum * sum);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.WriteLine((squareOfSums - sumOfSquares).ToString());&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I am not entirely sure how this problem made the cut. &amp;nbsp;Granted, squaring the first 100&amp;nbsp;natural&amp;nbsp;numbers would take a bit, but this is not challenging in any programming language at all. In fact most graphing calculators can be programmed to do this with little to no effort. &amp;nbsp;That being said...&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I started off simply with two variables, one for the sum of the integers themselves, and one for the sum of the squares. &amp;nbsp;For through the numbers needed adding each one to the sum variable and the square (number * number) to the sumOfSquares variable. &amp;nbsp;At the end I squared the sum that I had running (not the sumOfSquares), subtracted the two, and printed the answer.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Up next week will be problem 7 dealing with Prime Numbers again. &amp;nbsp;Those really seem to be a running favorite, at least in the early&amp;nbsp;questions. Until then...&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7183034546314373052?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7183034546314373052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7183034546314373052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7183034546314373052'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/05/project-euler-problem-6.html' title='Project Euler - Problem 6'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7427379055814812277</id><published>2011-04-29T10:33:00.000+02:00</published><updated>2011-04-29T10:33:51.611+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming Tips'/><title type='text'>Premature Optimization or Excessive Optimization</title><content type='html'>Premature Optimization refers to the process of optimizing incomplete code, or optimizing a program before that program is even finished. &amp;nbsp;Excessive Optimization refers to adding absurd&amp;nbsp;amounts&amp;nbsp;of optimization to a program that do not result in any&amp;nbsp;noticeable&amp;nbsp;gains.&lt;br /&gt;&lt;br /&gt;I am bringing these two points up now because they directly relate to what is currently happening with the Project Euler problems. They are at a point, still early on, when a simple brute force approach will suffice. Is it possible to whip up an algorithm that will do it in a fraction of the time? &amp;nbsp;Sure. &amp;nbsp;Is it worth it when the amount of time saved will not even be noticeable unless you are taking benchmarks of the apps? &amp;nbsp;Not so much. &amp;nbsp;What about since the whole point of these exercises (at least in my opinion) is to get the ground work laid out showing what can be expected in terms of mathematical difficulty? &amp;nbsp;Even less so.&lt;br /&gt;&lt;br /&gt;Many beginners to programming tend to worry far too much about getting a program to run as fast as possible. I have chatted with people that were trying to optimize their code so that the answer is given faster than the current speed of 0.5 SECONDS. &amp;nbsp;This is all well and good if used in a learning context, but if this is used in a production environment, then you just completely wasted your time since the end user won't even notice that change. &amp;nbsp;As with everything in this world there are exceptions, like if your program is going to be run several thousand times in a row, but that is just what needs to be taken into consideration here.&lt;br /&gt;&lt;br /&gt;Optimization is a good thing and is fairly important in the high-speed world of today, but it's value fades if improperly used. &amp;nbsp;If there is a tool that you are going to use (on average) once a week for a couple of months and then dispose of it, is there really a point in spending an extra 2 hours to get it milliseconds faster? &amp;nbsp;Following are a couple of things that I look at when making a tool or application to decide what level of optimization is really needed (in no&amp;nbsp;particular&amp;nbsp;order):&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Target Audience&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Personal use&lt;/li&gt;&lt;li&gt;For my wife or other family member&lt;/li&gt;&lt;li&gt;For general release&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Frequency of Use&lt;/li&gt;&lt;ul&gt;&lt;li&gt;One time use&lt;/li&gt;&lt;li&gt;Once a week&lt;/li&gt;&lt;li&gt;Once a day&lt;/li&gt;&lt;li&gt;Several times throughout the day&lt;/li&gt;&lt;li&gt;Several times, one right after the other&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Work/Play&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Am I being payed to make it?&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Time Involved&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Couple of minutes to streamline a couple of loops&lt;/li&gt;&lt;li&gt;Couple of hours to rewrite main logic&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;This is not an&amp;nbsp;exhaustive&amp;nbsp;list of course, just the main things that I run through in my head. &amp;nbsp;The target audience is pretty self explanatory. If I am making a quick tool for myself to go through 5,000 files and check that the version number is correct on them all I am not going to invest any time at all into optimizing. &amp;nbsp;If the program is going to be used in an automated build process by the company that I work for, I will optimize a little, but not much. If I am working on a game that I am planning to release to the general public I am going to optimize it as much as I can. &amp;nbsp;This ties directly into the frequency of use issue. &amp;nbsp;If I am making a tool that I am going to use once then erase optimizing is less likely to happen than if it is a program that is going to be (hopefully) used daily by millions of people all over the world. &amp;nbsp;This also ties loosely into the work/play scenario. &amp;nbsp;If I am doing something for my job I have to take into account how much time it will cost me to optimize and if that would be a good investment for my company to make. Everything that I code at work is costing the company money. &amp;nbsp;That is a perfect lead in to the last point, time involved. &amp;nbsp;If a program takes me 20 minutes to make and 90 minutes to optimize is that really worth it? &amp;nbsp;however if it takes me 5 hours to make and 5 minutes to optimize is that better? &amp;nbsp;Like I said though, these are just some of the things that I think about when it comes to optimization. &amp;nbsp;I would like to hear what others think about it though.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7427379055814812277?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7427379055814812277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/04/premature-optimization-or-excessive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7427379055814812277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7427379055814812277'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/04/premature-optimization-or-excessive.html' title='Premature Optimization or Excessive Optimization'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-1683290285512729884</id><published>2011-04-24T12:00:00.029+02:00</published><updated>2011-04-24T12:00:00.569+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 5</title><content type='html'>Welcome to week 4 of my Project Euler series.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Problem 4:&lt;/u&gt;&lt;br /&gt;What is the smallest number divisible by each of the numbers 1 to 20?&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;br /&gt;2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.&lt;br /&gt;&lt;br /&gt;What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;// What is the smallest number divisible by each of the numbers 1 to 20?&lt;/div&gt;&lt;div&gt;class Problem5&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bool notFound = true;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int number = 20;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (notFound)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bool evenlyDivisible = true;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (int i = 1; i &amp;lt;= 20; i++)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (number % i != 0)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;evenlyDivisible = false;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!evenlyDivisible)&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;number++;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;notFound = false;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(number);&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.Read();&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;br /&gt;&lt;div&gt;This one was really easy. A simple brute force approach yields the result in no time. &amp;nbsp;Sadly the days of brute forcing our way through this problems is coming very quickly to an end.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Since the end result was unclear, I chose to go with a while loop. A do-while loop would have worked just as well since I new it was going to run at least once, but that is simply a matter of personal opinion. &amp;nbsp;I prefer the while loop (when I have a choice) simply because it allows you to see the condition, when reading the code, before you actually get to what it will be doing. &amp;nbsp;A basic bool is used as the test&amp;nbsp;criteria&amp;nbsp;so I can change it with an if check in the loop. &amp;nbsp;I start the loop off at number 20, because no number under that is going to be divisible by 20. &amp;nbsp;At least not in the sense of what they are looking for. &amp;nbsp;In all honesty it could have started a great deal higher than that, but I chose to let the program do all the work, with only hard coding what can be gained from the question. &amp;nbsp;For each consecutive number I check if it is&amp;nbsp;divisible&amp;nbsp;by every number between 1 and 20. &amp;nbsp;If it is then we have a winner! &amp;nbsp;Toss it on the console and wait for the user to press any key to continue. &amp;nbsp;If it is not a match then I move right along to the next number. It doesn't get much simpler than that.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After this one, we have a couple of more brute force approaches, then things really start to take off. &amp;nbsp;As I said in the beginning, these problems are not overly difficult. Some of them are of course, but there are some that are really simple. &amp;nbsp;The thing that complicates them is that they are stretched out. &amp;nbsp;For example finding the first number that is&amp;nbsp;divisible&amp;nbsp;by every number between 1 and 5 could be done by hand. It would take some time, effort, sweet, and tears, but it is in the end possible. &amp;nbsp;So is this problem, but from the time that is needed it is no longer what a normal person would consider solvable by hand. &amp;nbsp;A couple of magic keystrokes later and a couple of seconds wait and we have an answer. That is really the beauty of programming.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Until next time...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Enjoy!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-1683290285512729884?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/1683290285512729884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1683290285512729884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1683290285512729884'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-5.html' title='Project Euler - Problem 5'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-1150994105435063208</id><published>2011-04-17T12:00:00.028+02:00</published><updated>2011-04-17T12:00:03.327+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 4</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 4 of my Project Euler series.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 4:&lt;/u&gt;&lt;br /&gt;Find the largest palindrome made from the product of two 3-digit numbers.&lt;/div&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;/div&gt;A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 &lt;img border="0" src="http://projecteuler.net/images/symbol_times.gif" /&gt; 99.&lt;br /&gt;&lt;br /&gt;Find the largest palindrome made from the product of two 3-digit numbers.&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;// Find the largest palindrome made from the product of two 3-digit numbers.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem4&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int product;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int answer = 0;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;string productString;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = 999; i &amp;gt; 99; i--)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j = 999; j &amp;gt; 99; j--)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;product = i * j;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;productString= product.ToString();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (productString&amp;nbsp;== ReverseString(productString))&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (product &amp;gt; answer)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;answer = product;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.WriteLine(answer);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static string ReverseString(string input)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var inputArray = input.ToCharArray();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var reversedValue = string.Empty;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = input.Length-1; i &amp;gt;= 0; i--)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;reversedValue += inputArray[i];&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return reversedValue;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;/div&gt;&lt;div&gt;I am not sure why, but this one caused me a little too much&amp;nbsp;grief. &amp;nbsp;I was thinking entirely too hard about it. Once I decided to simplify it to&amp;nbsp;ridiculous&amp;nbsp;proportions, then it worked. &amp;nbsp;I have three variables. &amp;nbsp;The first is for the product of the current three digit numbers, the second is the current highest product, and the third is the current product as a string. &amp;nbsp;The main loop of this program is a for inside a for, so that we can go through the list from 100 to 999 twice, since it is the sum of &lt;u&gt;two&lt;/u&gt;&amp;nbsp;three digit numbers. The following steps go pretty fast. I take the product, check if it is the same reversed, then see if it is larger than the reigning champ. &amp;nbsp;If so swap it out, then move on to the next. &amp;nbsp;The final steps as always are print and finish.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The reversal of the number is also very easy. I simply turn it into an array of characters, then loop through it backwards, placing them at the first empty space that is found. &amp;nbsp;A quick save and return, and all is well in the world.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This problem really moved along first when I stopped thinking about it too much. I could hear every programming instructor or professor that I have ever had yelling "KISS - Keep It Simple Stupid" over and over. &amp;nbsp;Perhaps they didn't yell it, but it got drilled into us all in either case. &amp;nbsp;And it really is true as I found out first hand.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Until next time...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Enjoy!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-1150994105435063208?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/1150994105435063208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1150994105435063208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1150994105435063208'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-4.html' title='Project Euler - Problem 4'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7662066858404995873</id><published>2011-04-10T12:00:00.003+02:00</published><updated>2011-04-10T12:00:10.002+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 3</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Welcome to week 3 of my Project Euler series.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Problem 3:&lt;/u&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;&lt;/u&gt;Find the largest prime factor of a composite number.&lt;/div&gt;&lt;div style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;&lt;/u&gt;The prime factors of 13195 are 5, 7, 13 and 29.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;What is the largest prime factor of the number 600851475143 ?&lt;span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Find the largest prime factor of a composite number.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;class Problem3&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var list = PrimeFactors(600851475143);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.WriteLine(list.Last());&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Read();&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;///&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;summary&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/// Returns a list of the prime factors of a number in ascending order.&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;///&lt;/summary&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;///&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The number to factor&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;///&amp;nbsp;&lt;returns&gt;List of prime factors&lt;/returns&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static List&lt;long&gt;&amp;nbsp;PrimeFactors(long i)&lt;/long&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (i &amp;lt; 2)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;throw new ArgumentOutOfRangeException("Numbers less than 2 don't have prime factors");&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;List&lt;long&gt;&amp;nbsp;result = new List&lt;long&gt;();&lt;/long&gt;&lt;/long&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int divisor = 2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;while (divisor &amp;lt;= i)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (i % divisor == 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;result.Add(divisor);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;i /= divisor;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;divisor++;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return result;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;This one took slightly more work then the previous ones did. &amp;nbsp;Right from the beginning I could see the appeal of prime numbers to the people that created the questions for Project Euler, so I decided to make that into a method by itself that could be then reused whenever they came up.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;The method PrimeFactors does just that. &amp;nbsp;It takes in a number and finds all prime numbers that are available up to that number. &amp;nbsp;I started off with a check to see if the number that is given to the method is less than 2 simply because no number under 2 can be a prime number so no point even checking. &amp;nbsp;If that checks out to be okay I then lay out a couple of variables. One for the list of primes that are found, and the other is the divisor that is currently used (starting at 2 of course). &amp;nbsp;Now the meat and potatoes of this method, the loop. I have done it in a while loop just to have the constant checking without an actual value to use as the endpoint. &amp;nbsp;It will keep going until the divisor is less than or equal to the number (not prime numbers are going to come after that point so no point in checking). &amp;nbsp;Inside the loop I check for a remainder when I divide the number by the divisor. &amp;nbsp;If there isn't one the divisor is obviously a prime and it is added to the list. &amp;nbsp;The number is then divided by that number to remove the instances where that number will have to be rechecked. &amp;nbsp;If a remainder is found, then the divisor is increased. &amp;nbsp;In this manor it continues until the divisor and the number meet or pass each other. &amp;nbsp;The list is returned at the end.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;I simply take the list that is returned, display the last number (which will be the largest) and close with the next key stroke. &amp;nbsp;All the action here takes place solely in the prime method so it might have worked out this time to &amp;nbsp;simply print the answer from within, but I wanted to make a method that was transportable and reusable so I have those three lines in my main to display results.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Problem 4 did cause me a little bit of grief to be perfectly honest, but once the&amp;nbsp;caffeine got kicked into high gear and the ball started rolling it was fairly simple as well. &amp;nbsp;Most of these seem to be pretty easy to get once the answer is known. That is true with most problems though. &amp;nbsp;Until next time...&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Enjoy!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7662066858404995873?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7662066858404995873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-3_10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7662066858404995873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7662066858404995873'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-3_10.html' title='Project Euler - Problem 3'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-4583884288750331150</id><published>2011-04-04T11:58:00.001+02:00</published><updated>2011-04-08T14:54:56.592+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Clarification and Explanation</title><content type='html'>I have recently started a series that I am going to be running about the solutions that I have come up with for Project Euler. &amp;nbsp;The first two solutions are already posted and I thought it might be a good idea to clarify how I am going to be presenting the info and why. &amp;nbsp;Better late than never after all...&lt;br /&gt;&lt;br /&gt;&amp;nbsp;I will present the problem as it states on the Project Euler page followed by the details that are given about the problem. Both of these sections will be nothing more than a quick copy and paste. &amp;nbsp;Next will come the code. Unless stated otherwise it will be in C# with .NET 3.5 (although until the writing of this post I have not used any&amp;nbsp;functionality&amp;nbsp;that is not available in .NET 1.1). &amp;nbsp;Following the code will be an explanation of how I went about solving the problem and why.&lt;br /&gt;&lt;br /&gt;This does make an interesting predicament as most of the problems could be solved with a "brute force" approach. &amp;nbsp;To that end, the Project Euler team has specified that the problems were designed so that they can be solved by a computer of reasonable&amp;nbsp;capabilities&amp;nbsp;in no more than one minute. If it takes longer than that, then most likely there is a better approach that could be used.&lt;br /&gt;&lt;br /&gt;The solutions presented here are my solutions. They are not the only solution, and they might not even be the best solution, but they are how I solved the problem. I won't post a solution here unless it is the one that I actually used to get the answer that was accepted by Project Euler. &amp;nbsp;If you have another way of doing it, or some other comment about my solution I will gladly read the comments that I get.&lt;br /&gt;&lt;br /&gt;These posts will be coming once a week, and I will try and have them ready to post even if I am not available to post them personally at the right time. &amp;nbsp;I think that about covers the organizational "good to know"s about this series. &amp;nbsp;I hope you like it and perhaps even learn a little something from it. &amp;nbsp;Until next time...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-4583884288750331150?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/4583884288750331150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-clarification-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4583884288750331150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4583884288750331150'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-clarification-and.html' title='Project Euler - Clarification and Explanation'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-3657141016126592105</id><published>2011-04-04T11:19:00.001+02:00</published><updated>2011-04-04T11:33:39.580+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 2</title><content type='html'>I have decided to make the Project Euler posts a weekly thing. &amp;nbsp;That being said...&lt;br /&gt;&lt;br /&gt;Welcome to week 2 of Project Euler.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Problem 2:&lt;/u&gt;&lt;br /&gt;By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;/div&gt;Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:&lt;br /&gt;&lt;br /&gt;1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...&lt;br /&gt;&lt;br /&gt;By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;//By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;class Problem2&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int term1 = 1;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int term2 = 2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int term3 = 3;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int total = 2; // first even numbered element won't be found by&amp;nbsp;Fibonacci&amp;nbsp;logic&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;do&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(term3%2 == 0)&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;total += term3;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;term1 = term2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;term2 = term3;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;term3 = term1 + term2;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;} while (term3&amp;lt;4000000);&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Write(total); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Read(); &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;}&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;br /&gt;This problem was another overly easy one if you have a grasp of what the Fibonacci sequence is all about. &amp;nbsp;It is, simply put, that each number is equal to the sum of the two previous numbers. &amp;nbsp;This requires nothing more than three variables. &amp;nbsp;The third variable is equal to the first two, then each variable is shifted back one. To expand slightly, after the addition is made the second variable is stored in the first, and the third variable is stored in the second. This leaves you free to use the third to hold the new sum. &amp;nbsp;I repeated this process over and over again until the third value was over 4,000,000 (as per the problem). &amp;nbsp;After the addition each time I checked what the remainder was of the third term (our sum) and two. &amp;nbsp;I simpler words, I checked if it was even. &amp;nbsp;If it was then it went into our running total. &amp;nbsp;As will always be the case, at the end I printed out the answer so I could enter it into the site, just to make sure I was right.&lt;br /&gt;&lt;br /&gt;This one really didn't have any subtleties that needed to be addressed, and with some very basic math it was easily solvable. &amp;nbsp;I didn't take the time to try and optimize my code at all do the simplicity involved, but I might do that at some point in the future. &amp;nbsp;For example, the logic for finding the&amp;nbsp;Fibonacci sequence to a certain point could be moved to a different method and then the list parsed for even number values. &amp;nbsp;We will have to see if I decide to do that or not.&lt;br /&gt;&lt;br /&gt;Up next week will be problem 3 dealing with Prime Numbers. &amp;nbsp;The post is looking like it will be a little more involved than these first two were. Until then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-3657141016126592105?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/3657141016126592105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3657141016126592105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3657141016126592105'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/04/project-euler-problem-2.html' title='Project Euler - Problem 2'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8396681622992767521</id><published>2011-03-27T23:24:00.002+02:00</published><updated>2011-04-04T11:36:25.983+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler - Problem 1</title><content type='html'>I am going to do a series on here based on the problems that are presented at &lt;a href="http://projecteuler.net/"&gt;Project Euler&lt;/a&gt;. &amp;nbsp;They will not only show the solution that I came up with, along with an explanation of why I did it that way, and (possibly) some other ideas I have tried out. &amp;nbsp;There could be some significant breaks in the series since I don't have all 330+ problems solved, so please bare with me.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Problem 1:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;Add all the natural numbers below one thousand that are multiples of 3 or 5.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;Details:&lt;/u&gt;&lt;/div&gt;If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.&lt;br /&gt;Find the sum of all the multiples of 3 or 5 below 1000.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;class Problem1&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;static void Main(string[] args)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int result = 0;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = 1; i &amp;lt; 1000; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ((i % 3 == 0) || (i % 5 == 0))&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;result += i;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Write(result);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Console.Read();&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;br /&gt;This one was pretty straight forward and easy. &amp;nbsp;I simple loop through all the numbers, checking each one if it is divisible by 3 or 5. &amp;nbsp;If it is then add it to the pot. &amp;nbsp;At the end I simply displayed this value so that I could enter it into the site for the go ahead. &amp;nbsp;The one thing that could be tricky about this problem is that it says all numbers &lt;i&gt;below&lt;/i&gt;&amp;nbsp;1000, non inclusive. &amp;nbsp;I have found that it can be very frustrating if the problem and additional information are not carefully read.&lt;br /&gt;&lt;br /&gt;The next problem has a bit more math involved, but it is also pretty straight forward. &amp;nbsp;I will post that one in a couple of days. No point overwhelming anyone.&lt;br /&gt;&lt;br /&gt;Until next time...Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8396681622992767521?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8396681622992767521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/03/project-euler-problem-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8396681622992767521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8396681622992767521'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/03/project-euler-problem-1.html' title='Project Euler - Problem 1'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2384297313068820014</id><published>2011-03-25T14:49:00.001+01:00</published><updated>2011-03-27T22:42:14.763+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Euler'/><title type='text'>Project Euler</title><content type='html'>I am holding off on more WiX tutorials until I find out if the one I already did was approved or not. &amp;nbsp;That doesn't mean I have been bored. I have recently discovered&amp;nbsp;&lt;a href="http://projecteuler.net/"&gt;Project Euler&lt;/a&gt;. &amp;nbsp;It is a site that posts various mathematical questions that are best solved with programming. &amp;nbsp;I suppose it is possible to do them with pen and paper, but that would take immense amounts of work and defeat the purpose. &amp;nbsp;The purpose being of course to expand my mathematical thinking in my programming. &amp;nbsp;So far it has been a bit slow getting started, because I don't normally do a lot of real heavy math programming, and it has been a while since my last math class of any kind. The cob webs are on their way out, and I am starting to get quicker at finding the solutions. On the right you can see a picture that shows my current progress. &amp;nbsp;This is kind of fun to be honest.&lt;br /&gt;&lt;br /&gt;Until next time, Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2384297313068820014?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2384297313068820014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/03/project-euler.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2384297313068820014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2384297313068820014'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/03/project-euler.html' title='Project Euler'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-978741250026040083</id><published>2011-03-21T16:51:00.000+01:00</published><updated>2011-03-21T16:51:48.297+01:00</updated><title type='text'>It is like seeing a ghost</title><content type='html'>I am back again! &amp;nbsp;After an long absence due to work, personal stuff, non personal stuff, and about 3.5 million other things, I am back once again.&lt;br /&gt;&lt;br /&gt;I have not been very busy working on my games in my absence sadly, but I have been working on my&amp;nbsp;&lt;a href="http://press.adkins-software.com/"&gt;books&lt;/a&gt;, and I have started writing tutorials for&amp;nbsp;&lt;a href="http://www.dreamincode.net/"&gt;Dream In Code&lt;/a&gt;. I am going to be doing a serious about WiX (Windows Installer XML). &amp;nbsp;That is my current project at the real job, and one that could pay dividends when it comes to my games. &amp;nbsp;Every program that is worth making, should be worth distributing as well. Windows Installer is the easiest way to distribute .NET applications, and WiX is my way of doing that.&lt;br /&gt;&lt;br /&gt;Enough rambling about real life though, it is now on to the games. I have (finally) gotten my hands on a real reference to a graphics library that explains things in a way that both teaches me, and keeps me from falling asleep. &amp;nbsp;It is, once again, a new library with a learning curve and everything, but this time I have a guide to help me learn. &amp;nbsp;Also I am going to programming directly to OpenGL so there is a rather large support community there. &amp;nbsp;I should clarify, a rather large &lt;b&gt;active&lt;/b&gt;&amp;nbsp;support community. &amp;nbsp;No promises on a new game, or even a new idea, or anything really. &amp;nbsp;Just the promise that I am still alive and still learning and expanding.&lt;br /&gt;&lt;br /&gt;Till next time, Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-978741250026040083?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/978741250026040083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2011/03/it-is-like-seeing-ghost.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/978741250026040083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/978741250026040083'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2011/03/it-is-like-seeing-ghost.html' title='It is like seeing a ghost'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8630441556131777043</id><published>2010-11-14T18:24:00.001+01:00</published><updated>2011-05-09T11:21:30.199+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website News'/><title type='text'>Face lift for the website!</title><content type='html'>Adkins-Software.com has undergone a face lift.&amp;nbsp; It is new improved, and a lot better looking if I do say so myself.&amp;nbsp; It includes the new logo, the new slogan, and some kewl new features that just have to be checked out as soon as possible!&amp;nbsp; A huge thanks to Harry Gibson for this great work.&amp;nbsp; He is an up and coming web designer and from what I have seen here and my experience working with him, he will go on to do great things!&amp;nbsp; Stay tuned for more software coming out as well to welcome this new site.&amp;nbsp; Till then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8630441556131777043?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8630441556131777043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/11/face-lift-for-website.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8630441556131777043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8630441556131777043'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/11/face-lift-for-website.html' title='Face lift for the website!'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7021338507887777510</id><published>2010-09-06T15:17:00.002+02:00</published><updated>2010-09-06T15:25:23.639+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Paddles and Balls'/><category scheme='http://www.blogger.com/atom/ns#' term='Villains Hope'/><category scheme='http://www.blogger.com/atom/ns#' term='Game Design'/><title type='text'>New game under development</title><content type='html'>Well into this weekend I am hoping to place the final touches on Paddles and Balls so that it can be released out into the world in all its glory.  That is awesome and I can't wait for it to happen. I am going to submit it to a couple of different websites for inclusion in databases and also place it in it's rightful place on the website.  Look for an announcement when that finally happens.  Should be soon!&lt;br /&gt;&lt;br /&gt;Aside from that I have begun working on another game that will really push my abilities as a program, and hopefully be a great learning experience as I look at the design side of software creation more and more. Till now all my games have been ideas that went straight to source code with all other details coming as they caused problems in what I was doing. This model of software creation is (shocking though this may be) frowned upon by anyone that has done any amount of serious programming.  I am going to change that with this new game.  How so you might be wondering. I will tell you.  First off I have already completed the initial version of the Design Document.  I have never made one of these before and I think this first attempt turned out really well.  I am looking into ways to protect my idea before I release that document for review. This idea for a game is (as far as I know at least) unique.  I have actually never came across a game quite like it in all my travels through virtual worlds.  More details on this project will follow though, so keep your eyes and ears out for the game code named "Villains Hope."  Until then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7021338507887777510?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7021338507887777510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/09/new-game-under-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7021338507887777510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7021338507887777510'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/09/new-game-under-development.html' title='New game under development'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2236155582385100750</id><published>2010-09-01T14:24:00.002+02:00</published><updated>2010-09-06T15:51:00.214+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='External Projects'/><category scheme='http://www.blogger.com/atom/ns#' term='Paddles and Balls'/><category scheme='http://www.blogger.com/atom/ns#' term='Villains Hope'/><title type='text'>Long sad absence</title><content type='html'>I have been away for quite some time now. The reason being that my computer is currently not operational.  The power cable is broke so it is now nothing more than a big, ugly, paper weight.  That will be remedied here in the near future, but that hasn't stopped me from working on some game related stuff.&lt;br /&gt;&lt;br /&gt;I now have all the graphics and music for Paddles and Balls, so as soon as that is up and running then we can throw it all together and put out a released product.  A HUGE thanks to Shaun Mitchell for the graphics and to Edward Ryan for the music.  It all turned out way above my expectations. I am seriously hoping for the chance to work with both of these guys again in the near future.&lt;br /&gt;&lt;br /&gt;In addition to gathering everything together for Paddles and Balls, I have also started the organizational and planning that is needed for a team effort that I have joined. It is called Infinite Universe and I will be doing large amounts of programming to help out those guys.  They are all really ambitious, know exactly what they want, and have a load of art work done already so I have a bit of catching up to do on that one.  This won't stop me from working on my own games, it will just slow the wheels of progress a bit.  That is not a bad thing, because experience working in a group like surely can't hurt anything.&lt;br /&gt;&lt;br /&gt;Speaking of my own games, I already have the vague idea down for my next game.  It is something that I can't actually remember seeing anywhere and I am really excited about it.  I will give out more details about that one once I get some more planning done on it.  It is really amazing how much I can get done without my computer to mash out code on.  I think I might have to take a break from coding more often. Really helps to keep things organized and slow the spinning out of control.&lt;br /&gt;&lt;br /&gt;Until next time...&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2236155582385100750?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2236155582385100750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/09/long-sad-absence.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2236155582385100750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2236155582385100750'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/09/long-sad-absence.html' title='Long sad absence'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-1978043797699436061</id><published>2010-07-21T21:21:00.002+02:00</published><updated>2010-09-06T16:29:34.207+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Beta Testing'/><category scheme='http://www.blogger.com/atom/ns#' term='Paddles and Balls'/><title type='text'>New Paddles and Balls release</title><content type='html'>Some problems with the Pong release were reported to me.  They have been repaired.  There have also been some minor additions as well. Not quite what I was hoping for but it is still progress.  You can now choose the color of the paddles. It is progress. Early next week I am planning to release another version with the ability to choose how many balls you want in play.  We are coming to the finished product, slowly but surely.  Till then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-1978043797699436061?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/1978043797699436061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/07/new-paddles-and-balls-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1978043797699436061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1978043797699436061'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/07/new-paddles-and-balls-release.html' title='New Paddles and Balls release'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-5385713722162845991</id><published>2010-07-01T10:19:00.002+02:00</published><updated>2010-09-06T16:30:27.738+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Beta Testing'/><category scheme='http://www.blogger.com/atom/ns#' term='Paddles and Balls'/><title type='text'>Beta testing for others</title><content type='html'>So I have been working on the improvements to Pong that can bring it closer and closer to Release Candidate status as expected.  The main menu is almost finished and I am expecting that to be out as part of Beta 2 in the very near future.  I still haven't found the music that I really want, but there are a few other ideas that are bouncing around in my head.  It is really going good.&lt;br /&gt;&lt;br /&gt;That is not my only project however.  I am also trying to actively partake of the Beta testing for the new version of Firefox (Firefox 4.0 Beta 1).  I downloaded it and installed it yesterday and was quite impressed.  Normally when one uses a Beta 1 for any product you expect rather decent sized bugs, an excessively slow install, and just the general idea to be out there.  That however is not the case here.  First thing that had me impressed was the install.  It was lightning quick.  Given the shun that installer creation is normally looked upon in the software development world this was a pleasant surprise for me (and massive kewl points).  I then loaded it. The visual layout has changed a little bit, and the jury is still out on what exactly I think of it.  The tab bar is just below the menu bar, then comes the address bar, then the bookmark toolbar, then the actual page itself.  For me it just seems more natural to have the tab toolbar directly over the pages.  That is not majorly evil, or a deal killer, just not too comfy and natural for me.  The pages loaded however and looked good.  Nothing was distorted, or out of place.  It worked really well.  The only other problem that I have found so far is that when you open a tab it says "New Tab" which is expected, but then you have to go to a different tab and back to get rid of that and start seeing the name of the site in that tab.  This is another annoyance, and bug that was reported, but not a deal killer.  Overall I think Firefox 4 is looking to be another top product from the team over at Mozilla.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-5385713722162845991?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/5385713722162845991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/07/beta-testing-for-others.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5385713722162845991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5385713722162845991'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/07/beta-testing-for-others.html' title='Beta testing for others'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8993045581742982633</id><published>2010-06-28T21:27:00.003+02:00</published><updated>2010-09-06T16:31:01.044+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website News'/><category scheme='http://www.blogger.com/atom/ns#' term='Paddles and Balls'/><title type='text'>New addition and more news.</title><content type='html'>We have yet another addition to the set at &lt;a href="http://www.adkins-software.com/"&gt;Adkins-Software.com&lt;/a&gt;.  That would be Pong.  This is my first true journey into the realm of graphics programming.  It is currently only released for beta testing, but more functionality is coming soon.  That will include (but not limited to) better graphics to include better animations, sound, menus, and more (none of these features are guaranteed, but just ideas).  I will let you know when the final version is released.  Kewl stuff to be sure.&lt;br /&gt;&lt;br /&gt;In addition to that &lt;a href="http://www.adkins-software.com/"&gt;Adkins-Software.com&lt;/a&gt; has been registered with 25 different international search engines.  Will be doing another 25 in the coming weeks.  I might also add in a hit counter just to see how many people out there actually go to the site.  Who knows though. That is a thought for a different time.  Till then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8993045581742982633?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8993045581742982633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/06/new-addition-and-more-news.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8993045581742982633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8993045581742982633'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/06/new-addition-and-more-news.html' title='New addition and more news.'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2976854705565832672</id><published>2010-05-07T21:32:00.002+02:00</published><updated>2010-09-06T16:31:19.902+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Text Twist'/><title type='text'>First rating of a game from Adkins-Software.com</title><content type='html'>Today one of the games from Adkins-Software.com was added to the site over at Sofotex.com.  The game was Text Twist (six letters, 2 minutes, as many words as possible).  In addition to accepting it for placement on their site, they took the time to have an editor review it.  The outcome was better than I had expected.  It got a 5 star rating!  I am pretty happy with that and will be submitting the rest of my games to that site soon as well to see how they fare.  Wish me luck.  Until then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2976854705565832672?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2976854705565832672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/05/first-rating-of-game-from-adkins.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2976854705565832672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2976854705565832672'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/05/first-rating-of-game-from-adkins.html' title='First rating of a game from Adkins-Software.com'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-6802103463087777833</id><published>2010-05-04T15:26:00.002+02:00</published><updated>2010-09-06T16:32:12.715+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website News'/><category scheme='http://www.blogger.com/atom/ns#' term='Text Twist'/><category scheme='http://www.blogger.com/atom/ns#' term='Word Scramble'/><title type='text'>Moving and Shaking</title><content type='html'>Adkins-Software.com is back up and running as I said.  It was uploaded with two new games.  First Text Twist, where you have 6 letters and you have to make as many words as possible out of those letters in 2 minutes as you can.  Secondly is Word Scramble.  The goal here is to create the right word with the given letters.  It is so easy it can't possibly be fun, right?  Doubtful.  Try it out!&lt;br /&gt;&lt;br /&gt;In addition to that a new game is coming this weekend.  It is my entry into the Game Institute Challenge 16 (Free for All).  It is the game of Nim, a logic game that has a solution.  Will that solution help you to beat the computer though?  Or perhaps you would prefer to match wits with a friend?  The idea is simple, you can take up to 3 orbs (given they all come from the same pile).  Depending on the options you the person to take the last orb either wins or loses.  Simple?  Check!  Fun? Check!  I would call that a job well done.&lt;br /&gt;&lt;br /&gt;If you browse around the site a bit you will also notice a Job Center is now up. You read that right.  Adkins-Software.com is looking to expand it's numbers.  I would say it is worth checking out, but then again I am a little biased.  A forum is also in the works to be added in the coming weeks (goal is end of next week).  It will be a place for people to post comments, questions, and concerns, along with ideas for future games, or things they would like to see changed.  I am really excited about that.&lt;br /&gt;&lt;br /&gt;There are so many other things being worked on at the same time that I can't even think of them all right now.  You will just have to keep checking the site!  Till then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-6802103463087777833?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/6802103463087777833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/05/moving-and-shaking.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6802103463087777833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6802103463087777833'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/05/moving-and-shaking.html' title='Moving and Shaking'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8150582590288365639</id><published>2010-04-29T22:33:00.002+02:00</published><updated>2010-09-06T16:32:36.303+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website News'/><title type='text'>Quick update.</title><content type='html'>Just one quick little point to let you know.  &lt;a href="http://adkins-software.com/"&gt;ADKINS-SOFTWARE.COM&lt;/a&gt; IS BACK!  You read that right. I have just uploaded the first version of the new site to the server and any second after the writing of this it should be out there for everyone to see.  In the next couple of days I will do some more posts detailing what is new and what software you can look for on there. Till then just look around.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8150582590288365639?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8150582590288365639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/04/quick-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8150582590288365639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8150582590288365639'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/04/quick-update.html' title='Quick update.'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8462776624786585024</id><published>2010-04-28T22:53:00.002+02:00</published><updated>2010-09-06T16:32:56.308+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website News'/><title type='text'>Coming soon to a web browser near you!</title><content type='html'>This time I am serious!  Adkins-Software.com will be back up and running by Monday or your money back. I'm serious.  Also a new game is very near completion.  It is going to be entered in a game competition, and posted on the site for free download.  Then it is going to have it's functionality expanded a bit and be put on the internet for sale.  Not expecting overly great things out of it (sales wise), but I still figure why not.  Most likely it will go for $5 even.  Not all of that goes to me as I have to pay for the marketplace and other things too.  Plus 10% of all proceeds from all my gaming endeavors (for the time being) will go to charity.  More on that will follow once the game is out there for purchase.  Just some food for thought! &lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8462776624786585024?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8462776624786585024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/04/coming-soon-to-web-browser-near-you.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8462776624786585024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8462776624786585024'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/04/coming-soon-to-web-browser-near-you.html' title='Coming soon to a web browser near you!'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7844614710057943836</id><published>2010-04-08T14:47:00.001+02:00</published><updated>2010-04-08T14:47:22.642+02:00</updated><title type='text'>Update coming...Promise</title><content type='html'>Well Adkins-Software.com has been down for an unfortunate amount of time, but I assure you it is coming back and very soon.  In addition to this return I will have some new products to release shortly after it&amp;#39;s return too.  There is no point putting good software on a site with technical problems, so once everything is stable then I will put the new goods out there.  One that is for sure going to be going up there is a logic based game, complete with AI and graphical interface. I am pretty excited about that one.  A more full featured version of that one will be going on sale (simply to test the waters) early next month, so watch for an update on that.  There will also most likely be on other software suite that will be going on sale in the coming months that features word puzzles. I am considering placing basic versions of all the word puzzles for free on the site and selling a more feature rich software suite through the vendors that I have found.  You will have to keep checking in to see what happens with that.&lt;br&gt; &lt;br&gt;There is also the very real possibility that I will start posting some programs on the site that are not games.  Shocking I know, but I have started work on basic monthly budget tracker program, and once I get it to a point that I am happy with, and is functional enough I will add it for everyone to play with if they so choose.  Others in the non-game realm might follow as well.  Only time will tell.  Till then...&lt;br&gt; &lt;br&gt;Enjoy!&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7844614710057943836?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7844614710057943836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/04/update-comingpromise.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7844614710057943836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7844614710057943836'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/04/update-comingpromise.html' title='Update coming...Promise'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-4477143068815743723</id><published>2010-03-12T11:03:00.001+01:00</published><updated>2010-03-12T11:03:52.804+01:00</updated><title type='text'>Little down time</title><content type='html'>Well, the domain transfer for Adkins-Software.com is in full swing and the site is now officially in between hosts.  That means that it is down now, but I assure you that when it is once more up and running there will be new content added to the site.  I think a face lift might even be coming in the following in the following weeks.  Who knows though.  I have a lot of work to do so I can have it back up and running so, till next time.&lt;br&gt; &lt;br&gt;Enjoy!&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-4477143068815743723?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/4477143068815743723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/03/little-down-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4477143068815743723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4477143068815743723'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/03/little-down-time.html' title='Little down time'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-8402964684204638249</id><published>2010-03-06T20:48:00.002+01:00</published><updated>2010-03-06T20:56:32.763+01:00</updated><title type='text'>Software Certified Clean and added to database</title><content type='html'>Greetings!  It has been a while, but I am back.  Two big pieces of news to cover this time.&lt;br /&gt;&lt;br /&gt;First off I recently submitted a Hangman game that I created to be listed on &lt;a href="http://softpedia.com/"&gt;Softpedia.com&lt;/a&gt; and it was accepted.  While they were downloading it and testing it, they decided to also take Naillil v. 0.0.1.0 and Blackjack for their site as well.  This is huge for me.  In addition to my programs being listed on an external site for all to try and download, but they also certified my software clean, virus free, and ad-ware free.  This seems like nothing at all when said like that.  BUT I know have something to place on my website from an external party listing that they tested it.  THAT is huge for me!  My software has been tested and they liked it!  That brings me to the second news.&lt;br /&gt;&lt;br /&gt;Adkins-Software.com is moving to a new host.  Once this transition is complete then I will update it with the newest versions of all my programs along with some new ones.  You will have to check it out to see what they are.  During this transition it is a given that there may be some interruptions in service and such.  I apologize for that, but it must be done.  I will have another post here when everything is smoothed over.  Till then have a good one.  Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-8402964684204638249?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/8402964684204638249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/03/software-certified-clean-and-added-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8402964684204638249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/8402964684204638249'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/03/software-certified-clean-and-added-to.html' title='Software Certified Clean and added to database'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-5770620063772323255</id><published>2010-01-27T12:45:00.001+01:00</published><updated>2010-01-27T12:45:19.237+01:00</updated><title type='text'>Quest for video games</title><content type='html'>&lt;div class=Section1&gt;  &lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:10.0pt;font-family:"Times New Roman","serif"'&gt;For quite some time now I have been trying to create video games.&amp;nbsp; I have made some small &amp;#8220;toy&amp;#8221; games (blackjack, quiz program, ect.)&amp;nbsp; and started a few other projects as well.&amp;nbsp; I have always been side tracked, distracted, found something new and great to try, ect.&amp;nbsp; I have also joined several on line groups, discussion boards, forums, to meet other like minded individuals to bounce ideas off of and draw inspiration from. &amp;nbsp;I have noticed a shocking trend while perusing these online communities.&amp;nbsp; Oh so many hobby game developers do the same things.&amp;nbsp; One prime example was a blog that I was following where the writer was creating an RPG and documenting the entire thing.&amp;nbsp; His last blog entry said that he was moving on to some other project even though that one was unfinished.&amp;nbsp; While looking over some of his other topics in forums and such (we had crossed paths at several intersections) this was an ongoing trend.&amp;nbsp; IT ISN&amp;#8217;T JUST ME!&amp;nbsp; To celebrate this fact I made a new game last night. It is a small Hangman program.&amp;nbsp; Not big, not spectacular, but it is almost finished.&amp;nbsp; I have also decided to revisit some old projects.&amp;nbsp; New ideas, new knowledge.&amp;nbsp; Should make for some interesting steps for old games.&amp;nbsp; Also I have decided to put the 3D adventure on the middle burner for a sec.&amp;nbsp; I was getting in way over my head way too quick.&amp;nbsp; It is not on the back burner cause things there rarely make it to fruition, but it is not on the front burner cause I need a little more knowledge, know-how, and experience programming before I can do anything non damaging with it.&amp;nbsp; Expect hangman on the website any day now.&amp;nbsp; Till next time. Enjoy!&lt;/span&gt;&lt;span lang=EN-US&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-5770620063772323255?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/5770620063772323255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/01/quest-for-video-games.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5770620063772323255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/5770620063772323255'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/01/quest-for-video-games.html' title='Quest for video games'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-4104510242375798282</id><published>2010-01-04T12:24:00.001+01:00</published><updated>2010-01-04T12:24:42.752+01:00</updated><title type='text'>Progress is like a snowball</title><content type='html'>HAPPY NEW YEAR! Now that I have that out of the way onto business.&lt;br&gt;&lt;br&gt;I have been playing with LeadWorks Engine and reading through the tutorials and wow.  Simply wow.  It is so well put together, easy to use, and at the same time so robust and powerful.  It will be very little time till I can start cranking out games and putting them out there for the world to know and love.  It has also made it insanely easy to deal with learning 2 languages at once since I am having so much fun with language number 2.  Finally something to reign in the ADD and keep me going towards what I really wanna do.  So exciting.&lt;br&gt; &lt;br&gt;Within the coming week (hopefully) I will have it pretty much figured out how to move a character around a scene, then I will have all I need to put my first test game together and send it out.  It will be a pac-man remake but in the style of a first person shooter.  I know Pac-Man doesn&amp;#39;t shoot anything and I am not going to change that.  I simply think it might be entertaining to walk around as Pac-Man rather than control him from the top down.  Also bullets are really quite complicated so they will have to come at a later date.&lt;br&gt; &lt;br&gt;Till then...Enjoy!&lt;br&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-4104510242375798282?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/4104510242375798282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2010/01/progress-is-like-snowball.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4104510242375798282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4104510242375798282'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2010/01/progress-is-like-snowball.html' title='Progress is like a snowball'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2295004109699045885</id><published>2009-12-28T12:00:00.001+01:00</published><updated>2009-12-28T12:00:29.623+01:00</updated><title type='text'>New direction for my gaming industry</title><content type='html'>Once again I have taken a new turn my quest to create computer games.  For Christmas this year I have received a new game engine. Don&amp;#39;t know what that it?  Don&amp;#39;t worry about it.  Short version would be that it is a tool used to help create games.  Most (if not all) of the large game producers create their own game engine for each large scale release they do.  Lacking those funds, man power, time, and everything else that is needed to create such a tool, I have turned to third party tools.  The free ones just weren&amp;#39;t cutting it for me.  Then came jolly old St. Nick with a piece of saving glory. I won&amp;#39;t go into details (don&amp;#39;t wanna give away trade secrets after all), but my new toy seems so far to be exactly what I needed.&lt;br&gt; &lt;br&gt;Along with this shining ray of light though is a dark patch.  I am not forced to switch languages, but the amount of support for my current language of choice is so minimal that I am choosing to pick up a second (or third, or fourth) language.  It is one of the parents of my current work language (C#) and it is one that I have had encounters with in the past.  It is non other than C++.  I keep trying to jump ahead to the new great things in the industry to separate myself from the others, but keep getting pulled back.  I almost wish there were only one programming language and everyone used it and loved it. I suppose in that world though it would be damn near impossible to separate ones self from the competition.  Bummer.  I suppose I will just have to continue learning every programming language known to man.&lt;br&gt; &lt;br&gt;I don&amp;#39;t know what exactly is going to happen on the website.  I foresee a rather sizable dry spell till I get something worth putting on there, but as soon as I can find something worth of sharing with the world, you can believe it will appear!  Till then, Enjoy!&lt;br&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2295004109699045885?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2295004109699045885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/12/new-direction-for-my-gaming-industry.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2295004109699045885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2295004109699045885'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/12/new-direction-for-my-gaming-industry.html' title='New direction for my gaming industry'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7922294192014493242</id><published>2009-11-09T13:33:00.002+01:00</published><updated>2009-11-09T13:47:34.420+01:00</updated><title type='text'>The skinny on things</title><content type='html'>So here we go.  The run down on recent events.  I have upgraded my install of Visual Studio 2008 to the most current release, I have added Microsoft XNA Game Studio to it, and I have taken the online video tutorial into the world of making 2D games.  The tutorial came with graphics and insturction on how to do the basics.  I know it is cheesy but I will post it on the website anywho.  The only thing changed so far is the name.  It is now Moon Battle.  Enjoy.  It will have updates coming.  When playing please keep in mind that it is a learning experience.&lt;br /&gt;&lt;br /&gt;I have also been in contact with a graphic designer and composer for a different project I have been thinking over for quite some time.  All I will say right now is that it is a pac man spin off.  I am really excited about it, but don't have a release date.  Have to stay tuned for that.  I have also been adding to the story for my first RPG.  I am thinking that it might start off it's life as a side-scrolling adventure, then move over into the realm of the RPG's.  I actually just had that idea now while writing this blog, but I like it.  The story is more linear than the traditional RPG, but fits perfectly into the old Side Scrolling Adventure column.  Kewl.&lt;br /&gt;&lt;br /&gt;The website should also be updated sometime this week or next.  Some new programs will be added to it, some old programs will be updated.  The usual maintenance.  have to check there for those updates though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7922294192014493242?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7922294192014493242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/11/skinny-on-things.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7922294192014493242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7922294192014493242'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/11/skinny-on-things.html' title='The skinny on things'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2231464431986261022</id><published>2009-11-08T13:53:00.002+01:00</published><updated>2009-11-08T13:54:49.222+01:00</updated><title type='text'>I am back!</title><content type='html'>That is right.  I am back and I have brought great news from the game creation front. The only problem is my time right now is short and precious.  In the coming days I will have a longer post here describing my various adventures (or rather misadventures) with programming and the eventual end results.  Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2231464431986261022?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2231464431986261022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/11/i-am-back.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2231464431986261022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2231464431986261022'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/11/i-am-back.html' title='I am back!'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-3468949756627197276</id><published>2009-10-08T21:40:00.002+02:00</published><updated>2009-10-08T21:47:39.576+02:00</updated><title type='text'>I am alive... Seriously</title><content type='html'>So we now have internet!  How very kewl.  I have celebrated this by uploading the Uber-Pre-Beta Test (and I use that term loosely) of my new game.  It is a life long dream.  It is an ambition.  It is one of the big reasons why I want to learn all about the software life cycle, programming, design, and all things software creation related.  It is an RPG.  Before you get vision of Final Fantasy 7 (along with 1 and 3), or Diablo 2, or Oblivion, you should note that at this point it is only a text based adventure.  It is going to go through major changes under the hood in the coming weeks, but all you will notice is the addition of more and more story as time progresses.  Once I am happy with the story (or at least content) then I will start adding background images to match the part of the story you are in, and then....&lt;br /&gt;&lt;br /&gt;WAIT&lt;br /&gt;&lt;br /&gt;I appear to be getting ahead of myself.  So yeah, right now it is a crazy short text based RPG leaning adventure.  You will have to watch the site to know when the minor updates come up, but major updates will be seen here.&lt;br /&gt;&lt;br /&gt;Aside from that I have also remade my other 2 games (they are not released yet).  I know "remaking the wheel" and all, but I have learned a new language (and starting on my second and third next week) at work so I felt the need to tread familiar territory before delving into the deep dark (and usually scary) unknown too far.  I am working with C# for the main program, I am about to start working with XML next week. That is just in the office.  To keep things complicated in school we are working on HTML and are going to start Java the early part of next year.  If you search the blog history you will find that Java is the language I gave up to persue the new language that came with the job.  I am not amused.  I guess such is life though.  Time to go read through my 3.5 million e-mails from every junk mail and spam company on earth.  Enjoy the game!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-3468949756627197276?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/3468949756627197276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/10/i-am-alive-seriously.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3468949756627197276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3468949756627197276'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/10/i-am-alive-seriously.html' title='I am alive... Seriously'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-7552068211917608700</id><published>2009-08-30T21:04:00.001+02:00</published><updated>2009-08-30T21:05:52.673+02:00</updated><title type='text'>Truly sad day.</title><content type='html'>It has been confirmed.  We will have no internet starting the first of September for 4-6 weeks.  I don't know if I will be able to check personal e-mail (or do anything personal for that matter) on the computers at my new job. Only time will tell with that, but I won't be able to blog or update the website till we have internet at the house.  Truly sad, but I am faithful that we will all make it through this ;)&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-7552068211917608700?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/7552068211917608700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/08/truly-sad-day.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7552068211917608700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/7552068211917608700'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/08/truly-sad-day.html' title='Truly sad day.'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2784929777990611288</id><published>2009-08-23T18:04:00.002+02:00</published><updated>2009-08-23T18:09:27.574+02:00</updated><title type='text'>Why can life not consult me before popping in?</title><content type='html'>You may have noticed a complete lack of activity on here and on the &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt;.  Well it is going to get worse.   I have managed to find an apartment for Anya, Lillian, Loki, and I, but that left us with 2 or 3 weeks to pack, find a moving company, move in, and for me to prepare for reentry into the work force.  Fun?  Not so much.  Needed?  Absolutely.&lt;br /&gt;&lt;br /&gt;Everything except for my preparation for my coming employment and education has been completed.  Kind of.  We have most everything packed with the help of my mother-in-law and of course the 4 of us.  My mom is making the long trip from the states to come over and help with the actual move itself (since we can't move in till the day I start working).  I have never been one for doing things the easy way, but I believe this time I have out done myself.&lt;br /&gt;&lt;br /&gt;As of the first of September I will no longer have internet.  I am not amused, and I don't know when we will have it back.  Believe me when I say that when it comes back the world will know!  Till then...&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2784929777990611288?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2784929777990611288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/08/why-can-life-not-consult-me-before.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2784929777990611288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2784929777990611288'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/08/why-can-life-not-consult-me-before.html' title='Why can life not consult me before popping in?'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-739179444157447046</id><published>2009-08-06T16:50:00.001+02:00</published><updated>2009-08-06T16:57:50.499+02:00</updated><title type='text'>Blackjack Updated</title><content type='html'>Version 2.0.1 of Blackjack has been added to &lt;a href="http://adkins-software.com"&gt;the site&lt;/a&gt;.  The changes include adding a "Double" button for slightly more realistic game play, replacing the color indication of the winner with a small text in the margin, removing the help menu till I get a more sophisticated version implemented, and updating the betting so you can no longer bet money you don't have.  None of these are real earth shattering, but put together I felt that they were enough to warrant an upload to the site.&lt;p&gt;The reason the help menu was removed was because it was over simplified.  If the player had 15 or under it said hit, otherwise it said stay.  With the addition of the Double option this was no longer adequate.  I am currently working on translating the basic odds table for blackjack into an algorithm that I can use to make the recommendations more useful to the player. &lt;/p&gt;&lt;p&gt;I have one suit (Spades) finish in my deck of cards that I am creating.  Along with creating 3 more suits of cards so I can have a full deck of my own creation, I am working on adding the finished suit into the game.   If the ideas in my mind work out then expect a BIG update to blackjack very soon.&lt;/p&gt;&lt;p&gt;I wanna thank everyone that gave me tips and thoughts on my &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt;.   They all really helped me out and I hope everyone likes the changes  (pretty much every page was updated).  In addition to all these other  changes I have also started a mailing list to coincide with updates the my &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt;.  It is very easy to join, just send me an &lt;a href="mailto:adkins1984@gmail.com"&gt;e-mail&lt;/a&gt; and I will add you to it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-739179444157447046?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/739179444157447046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/08/blackjack-updated.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/739179444157447046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/739179444157447046'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/08/blackjack-updated.html' title='Blackjack Updated'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2608653446116909599</id><published>2009-08-02T11:36:00.006+02:00</published><updated>2010-09-06T16:38:41.280+02:00</updated><title type='text'>Program 2!</title><content type='html'>Program number 2 has been added to my &lt;a href="http://adkins-software.com/"&gt;homepage&lt;/a&gt;.  It is a basic GUI version of the classic game of BlackJack.  The cards are represented by their alpha-numeric versions (i.e. King = K, Ace = A, ect.).  I am currently working on recreating the wheel in the fashion of making my own deck of cards.  I know there are 3.5 gagillion decks of cards out there that can be downloaded, but since I am making the program from the ground up I figured I would go ahead and make everything.  Making a BlackJack game is recreating the wheel in it's own fashion anyways.  Currently it is only playable in one language, but more are coming in the form of German (and possibly Spanish some day too).  It has an over simplified help option that will tell you when to hit or when to stay.  Keep in mind it is way to overly simplified.  I am still working on improving that.  I am still working on improving a lot of things with it come to think of it, but it is working and playable so it is on the &lt;a href="http://adkins-software.com/"&gt;site&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Also I have added another version of the Prediction game.  I added a menu bar consisting of File, and Language menus, along with a 3 language options (English - DUH, German - kewl, Spanish - slightly amusing).  I also added a third button for answering which leads to a snappy come back.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2608653446116909599?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2608653446116909599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/08/program-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2608653446116909599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2608653446116909599'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/08/program-2.html' title='Program 2!'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-6737259376249031255</id><published>2009-07-20T11:06:00.002+02:00</published><updated>2009-07-20T11:09:45.378+02:00</updated><title type='text'>Seriously?  Another change?</title><content type='html'>Yes.  Once again things have changed.  Through my self teaching of Java I came upon that x-factor that I needed to start making small, mundane, and utterly useless programs.  These programs are full fledged desktop applications however.  The first one is up on the &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt;.  My host is a piece of crap, but when I last checked atleast one version of the software was up.  Once I got the program working I went a little over board so I have 2 versions on the site in 2 days.  Hope you enjoy it and if you know a thing or two about programming feel free to ask for the code, and give me some pointers.  Till then I will continue learning and expanding to improve this program and make more (hopefully at some point useful) programs.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-6737259376249031255?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/6737259376249031255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/07/seriously-another-change.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6737259376249031255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/6737259376249031255'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/07/seriously-another-change.html' title='Seriously?  Another change?'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-2396239458963944798</id><published>2009-07-18T12:48:00.002+02:00</published><updated>2009-07-18T12:51:56.010+02:00</updated><title type='text'>*sigh* Life has happened to me again...</title><content type='html'>As is so common in the past 25 years of my life, I have a great plan, things are going good, I am enjoying my time, and I am working toward a goal.  Then what happens?  Life!  As my last blog post said I was a very short time from posting my first program on my &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt;.  That time frame that I layed out has come and gone.  Still no program to post.  Why?&lt;br /&gt;&lt;br /&gt;I have been searching for employment and education.  That is a noble pursuit if I do say so myself, but it recently intesified and consumed rather large amounts of time.  I have actually found both linked very nicely together in the form of a German Ausbildung (rough translation = apprenticeship).  To find this though I have gone through numerous cross-country trips for interviews, taken countless online test, written 100's of e-mails, and done the other needed things that go with an intense and extrememly large employment search.  Now for the next problem. &lt;br /&gt;&lt;br /&gt;I have been working, learning, and playing with the Java programming language.  The job I found does not use Java so once again I will be changing languages.  That means that I will be starting over with my learning and must there-fore push back the release of my first pointless program for the &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you don't know there are countless different Programming Langauges in the world.  Each one with a general purpose.  Without employment it is very VERY hard to pick out which language to learn.  Everyone has their own opinion what is important to learn, know, and love.  Everyone also says that the others are wrong.  I have started to learn numerous Programming Languages over the year, only to stop and move on to another cause some knowing force in the computer world told me that I was on the wrong one.  Finally I have employment and education in the Software field.  Finally I have someone to give me a reason (by way of a pay check) to actually finish learning a language.  They won't tell me that I am learning the wrong one cause they are the ones telling me which one to learn.&lt;br /&gt;&lt;br /&gt;As for the &lt;a href="http://adkins-software.com"&gt;website&lt;/a&gt; I don't know what will happen with it in the near future.  I might just continue with my persuit of Java just for my own personal gains.  I also might not.  I think it is safe to say at this point "To be continued......"&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-2396239458963944798?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/2396239458963944798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/07/sigh-life-has-happened-to-me-again.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2396239458963944798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/2396239458963944798'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/07/sigh-life-has-happened-to-me-again.html' title='*sigh* Life has happened to me again...'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-3480408824043177627</id><published>2009-06-11T13:11:00.005+02:00</published><updated>2010-09-06T16:38:23.037+02:00</updated><title type='text'>I am still here</title><content type='html'>Yes I am still plugging along working on the programming.  Just yesterday as a matter of fact I created my first Window in Java.  Just so you know that is not a complete operating system.  No that will come later.  It was simply a blank window with the familiar 'X' in the corner to close it.  Why is this worth blogging.  I will tell you.  That is the start of the chapter in my book where I learn to create GUI's (Graphical User Interfaces).  Translation?  Very shortly I can take some of my "original" programs that I have created and start putting them on &lt;a href="http://adkins-software.com/"&gt;my website&lt;/a&gt; for all to criticize.  I, naturally, beg for only constructive criticism, and if you are in the programming world, or even have some history with Java feel free to request the source code from the programs.  There are no great secrets in my code, just a plea for tips, pointers, and "keep doing this" type stuff.  They are excessively commented and coming soon!  There will be a post here as well as a post on my other various social media sites when the first program gets posted to the site.&lt;br /&gt;&lt;br /&gt;Speaking of the &lt;a href="http://adkins-software.com/"&gt;site&lt;/a&gt; I am working on transferring to a different host, so if you experience problems getting to the site, please be patient and bare with me.  Thanks and..&lt;br /&gt;&lt;br /&gt;ENJOY!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-3480408824043177627?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/3480408824043177627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/06/i-am-still-here.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3480408824043177627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/3480408824043177627'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/06/i-am-still-here.html' title='I am still here'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-1338136218582126594</id><published>2009-05-21T17:33:00.001+02:00</published><updated>2009-05-21T17:38:53.383+02:00</updated><title type='text'>Re-invigorated</title><content type='html'>That last post really did something for me.  Firstly I have barely put down my Java book that I am reading right now.  Secondly &lt;a href="http://adkins-software.com"&gt;HTTP://adkins-software.com&lt;/a&gt; is officially up and running.  I didn't expect that to go quite as fast as it did, so I don't have any programs ready to post on it, but it is there sitting and waiting for something to go on it.&lt;br /&gt;&lt;br /&gt;If I can keep going the way I have been these past couple of days I will be posting programs, and expanding them in no time.  I just need to get past that boring hump in the book.  Every programming language has that point where you are not learning anything real earth shattering anymore, but you still don't have the knowledge that is needed to make really fascinating programs yet.  That is the boring hump.  That is where I am now.  For those of you that know Java I am learning about the various functions of class and method creation, with all the in and outs that is oh so very important to the language.  Also oh so boring cause I can't expand any of my personal programs that far with it.  I know it is needed and I know I must understand all this information to the t, but that doesn't always help.  Here is to hoping that I can make it this time around!&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-1338136218582126594?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/1338136218582126594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/05/re-invigorated.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1338136218582126594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/1338136218582126594'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/05/re-invigorated.html' title='Re-invigorated'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8609545074698148243.post-4236519607707336426</id><published>2009-05-19T20:41:00.003+02:00</published><updated>2009-05-19T23:25:00.286+02:00</updated><title type='text'>Awake</title><content type='html'>The first step in dreaming is to close your eyes.  The first step in making that dream true is to open your eyes back up and get to work.&lt;br /&gt;&lt;br /&gt;I don't know if that is a famous quote or not.  I don't normally come up with stuff that deep and insightful by myself so I am assuming I should be giving someone credit for that, but I don't know who that person is.&lt;br /&gt;&lt;br /&gt;That is not the point.  The point is that I have been laying out my plans, my dreams, my hopes, my wishes.  All failures.  Kind of.  I haven't failed at learning German.  I have learned German, I just don't know if I would consider myself fluent or not at this point.  I have not failed at learning Java (computer programming), but I have kind of slowed my learning by ridiculous amounts.  I haven't failed at my dream of climbing mountains.  I just have not made any progress.&lt;br /&gt;&lt;br /&gt;He does not know it, but I have taken some pointers from my brother.  He is a tax lawyer in California.  He works crazy hours, has training in different parts of the country, his personal life is "complicated."  He has still received numerous Scuba certifications, he is taking part in bike races and training for races.  Wow.  I have no job, and I travel all over my apartment.  Hmmm.  This needs to change.  I need to wake up from the dream and start turning reality into my dream.&lt;br /&gt;&lt;br /&gt;Introducing for the first time ever in history....&lt;br /&gt;&lt;br /&gt;&lt;a href="http://adkins-software.com/index.html"&gt;Adkins-Software.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That is right.  I have cashed in a gift certificate that I had sitting around unusable and this is what I got.  It is not a business right now.  It is not anything right now.  It is an incentive however for me to get off my butt and do something.  That is of course very metephorical since I will be doing stuff by reading and learning online, which is all done while sitting.&lt;br /&gt;&lt;br /&gt;There it is.  I have now done something to make my dream a reality.  Now to find the courage to continue moving forward!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8609545074698148243-4236519607707336426?l=blog.adkins-software.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.adkins-software.com/feeds/4236519607707336426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.adkins-software.com/2009/05/awake.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4236519607707336426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8609545074698148243/posts/default/4236519607707336426'/><link rel='alternate' type='text/html' href='http://blog.adkins-software.com/2009/05/awake.html' title='Awake'/><author><name>Chris Adkins</name><uri>http://www.blogger.com/profile/04165694167161405109</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
