<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx</link><description>As part of LitDev's December Challenges , Nonki suggested this Happy Number challenge: 
 "Calculate happy numbers below 1000." 
 
 Read more about Happy Numbers . 
 Math Man wasted no time in contributing this program: 
 Math Man's Happy Number Checker</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10382703</link><pubDate>Sun, 06 Jan 2013 22:21:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10382703</guid><dc:creator>Ed Price - MSFT</dc:creator><description>&lt;p&gt;Logic Thinker, &lt;/p&gt;
&lt;p&gt;You said, &amp;quot;There is not going to be an end of world.&amp;quot;&lt;/p&gt;
&lt;p&gt;Well, if it ended, would you know you were wrong? =^)&lt;/p&gt;
&lt;p&gt;Thanks to both of you. Good discussion.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10382703" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10380083</link><pubDate>Fri, 21 Dec 2012 12:50:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10380083</guid><dc:creator>logic thinker</dc:creator><description>&lt;p&gt;@Math Man&lt;/p&gt;
&lt;p&gt;Of course, I didn&amp;#39;t mean to teach You. :-)&lt;/p&gt;
&lt;p&gt;But I just wanted to mention that the problem about determining happy numbers is to repeat an action on a sequence until the length of items making the sequence = 1.&lt;/p&gt;
&lt;p&gt;Happy Holidays!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10380083" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10379573</link><pubDate>Wed, 19 Dec 2012 22:37:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10379573</guid><dc:creator>Math  Man</dc:creator><description>&lt;p&gt;@ logic thinker&lt;/p&gt;
&lt;p&gt;Yes. That is actually kind of what I did.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10379573" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10379424</link><pubDate>Wed, 19 Dec 2012 13:41:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10379424</guid><dc:creator>logic thinker</dc:creator><description>&lt;p&gt;@Math Man,&lt;/p&gt;
&lt;p&gt;You could do this app easier. Every digit is an character and the Text.SubString() for every character in text string: power up twice x * x and add to accumulator. Repeat, until accumulator is &amp;gt;=0 and &amp;lt;9. If accumulator = 1: happy, other: sad.&lt;/p&gt;
&lt;p&gt;accum = 0&lt;/p&gt;
&lt;p&gt;string = ...&lt;/p&gt;
&lt;p&gt;for every charcter in string&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;accum = accum + (character * character)&lt;/p&gt;
&lt;p&gt;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39;&amp;#39; a character is a single digit, so only it&amp;#39;s lenght is 1.&lt;/p&gt;
&lt;p&gt;end for every&lt;/p&gt;
&lt;p&gt;string = accum (Small Basic will make a string out of accum)&lt;/p&gt;
&lt;p&gt;if accum &amp;gt; 9 &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; repeat from the beginning, preserve the string&lt;/p&gt;
&lt;p&gt;endif&lt;/p&gt;
&lt;p&gt;if accum &amp;lt; 9 &amp;nbsp;then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if accum = then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;gt; HAPPY&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;SAD&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;endif&lt;/p&gt;
&lt;p&gt;endif&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10379424" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10379422</link><pubDate>Wed, 19 Dec 2012 13:30:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10379422</guid><dc:creator>logic thinker</dc:creator><description>&lt;p&gt;Ha, Ha, Ha&lt;/p&gt;
&lt;p&gt;21122012 - End Of World - is Happy.&lt;/p&gt;
&lt;p&gt;There is not going to be an end of world. :-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10379422" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10378803</link><pubDate>Mon, 17 Dec 2012 21:23:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10378803</guid><dc:creator>Ed Price - MSFT</dc:creator><description>&lt;p&gt;Math Man, I updated the link.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10378803" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10378787</link><pubDate>Mon, 17 Dec 2012 20:41:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10378787</guid><dc:creator>Math  Man</dc:creator><description>&lt;p&gt;Sorry, when I put the link at the end of the sentence, it thought the question mark was part of the link. Here&amp;#39;s the link: &lt;a rel="nofollow" target="_new" href="http://smallbasic.com/program/?DPH994-0"&gt;smallbasic.com/program&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10378787" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10378783</link><pubDate>Mon, 17 Dec 2012 20:38:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10378783</guid><dc:creator>Math  Man</dc:creator><description>&lt;p&gt;Ed, can you update the program link to &lt;a rel="nofollow" target="_new" href="http://smallbasic.com/program/?DPH994-0?"&gt;smallbasic.com/program&lt;/a&gt; It just contains a minor bug fix. Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10378783" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10378781</link><pubDate>Mon, 17 Dec 2012 20:33:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10378781</guid><dc:creator>Math  Man</dc:creator><description>&lt;p&gt;Please note, however, that if you enter &amp;#39;0&amp;#39; in the text box, it will crash. I will fix that as soon as I can.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10378781" width="1" height="1"&gt;</description></item><item><title>re: Small Basic - The Happy Number Challenge</title><link>http://blogs.msdn.com/b/smallbasic/archive/2012/12/17/small-basic-the-happy-number-challenge.aspx#10378779</link><pubDate>Mon, 17 Dec 2012 20:30:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10378779</guid><dc:creator>Math  Man</dc:creator><description>&lt;p&gt;I thought it was a good challenge because the check for happy numbers was recursive, so we had to be able to contain that recursion while still providing the correct answer to whether that was a happy number or not. The 6 smallest happy numbers are 1, 7, 10, 13, 19, and 23.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10378779" width="1" height="1"&gt;</description></item></channel></rss>