<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Euler Problem 80</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:28:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/#comment-39158</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 28 Apr 2009 01:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2378#comment-39158</guid>
		<description>&lt;p&gt;Hi Doug -&lt;/p&gt;
&lt;p&gt;So it is!  But what&#039;s two orders of magnitude ;-)&lt;/p&gt;
&lt;p&gt;I just wish Euler would accept 298,714,475,488.1710 as an answer.  That&#039;s what I get from the trendline coefficients.  Ought to be good enough!&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Doug -</p>
<p>So it is!  But what&#8217;s two orders of magnitude <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I just wish Euler would accept 298,714,475,488.1710 as an answer.  That&#8217;s what I get from the trendline coefficients.  Ought to be good enough!</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/#comment-39148</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Mon, 27 Apr 2009 14:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2378#comment-39148</guid>
		<description>&lt;p&gt;Michael - arrays are definitely worth getting a good handle on.&lt;/p&gt;
&lt;p&gt;I haven&#039;t looked at #72, and I don&#039;t have a lot of time spare at the moment, but if I do find time for it, and if I can solve it, I&#039;ll definitely report back here.&lt;/p&gt;
&lt;p&gt;By the way, 0.2*((10^6)^1.99) is much closer to 300 billion than 3 billion :)&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Michael &#8211; arrays are definitely worth getting a good handle on.</p>
<p>I haven&#8217;t looked at #72, and I don&#8217;t have a lot of time spare at the moment, but if I do find time for it, and if I can solve it, I&#8217;ll definitely report back here.</p>
<p>By the way, 0.2*((10^6)^1.99) is much closer to 300 billion than 3 billion <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/#comment-39146</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sun, 26 Apr 2009 22:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2378#comment-39146</guid>
		<description>&lt;p&gt;Hi Doug -&lt;/p&gt;
&lt;p&gt;If Prof Jarvis ever reads this thread, I apologize for misspelling his name above.&lt;/p&gt;
&lt;p&gt;I&#039;m not going to learn Python, I going to get a better handle on arrays.  That&#039;s quite (!) a speed jump.&lt;/p&gt;
&lt;p&gt;Have you done #72 yet?  My GCD method looks like it&#039;d still be running into next week if I let it, and my recursive solution exhausts the stack somewhere north on 100,000.  Using data points of D=10, 100, 1000, 10000, and 100,000, the answer is approximately 0.30*(D^1.99), or around 3 billion for D=10^6.  Not quite good enough.  I can&#039;t noodle out the trick.&lt;/p&gt;
&lt;p&gt;...mrt&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Doug -</p>
<p>If Prof Jarvis ever reads this thread, I apologize for misspelling his name above.</p>
<p>I&#8217;m not going to learn Python, I going to get a better handle on arrays.  That&#8217;s quite (!) a speed jump.</p>
<p>Have you done #72 yet?  My GCD method looks like it&#8217;d still be running into next week if I let it, and my recursive solution exhausts the stack somewhere north on 100,000.  Using data points of D=10, 100, 1000, 10000, and 100,000, the answer is approximately 0.30*(D^1.99), or around 3 billion for D=10^6.  Not quite good enough.  I can&#8217;t noodle out the trick.</p>
<p>&#8230;mrt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/#comment-39145</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Sun, 26 Apr 2009 12:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2378#comment-39145</guid>
		<description>&lt;p&gt;OK, did it with arrays.  I was tempted to use an array of 10 digit integers, to save memory, but it makes it much simpler to have one digit for each array location.&lt;/p&gt;
&lt;p&gt;Fairly straightforward with the help of Prof. Jarvis.  Run time = about 0.3 sec :)&lt;/p&gt;
&lt;p&gt;Function SqRtI(val As Long, Dig As Double) As Variant&lt;br&gt;
    Dim AA() As Long, BA() As Long, Digp As Long&lt;br&gt;
    Dim SumDig(1 To 1, 1 To 2) As Double&lt;br&gt;
    Dim i As Long, j As Long, k As Long, NumDig As Long&lt;br&gt;
    Dim BigVal As Long, dStep As Long, n As Long&lt;/p&gt;
&lt;p&gt;    SumDig(1, 2) = Timer&lt;br&gt;
    Digp = Dig + 10&lt;/p&gt;
&lt;p&gt;    For n = 2 To val&lt;br&gt;
        If n ^ 0.5 .NE. Int(n ^ 0.5) Then&lt;br&gt;
            ReDim AA(1 To Digp)&lt;br&gt;
            ReDim BA(1 To Digp)&lt;/p&gt;
&lt;p&gt;            AA(1) = n * 5&lt;br&gt;
            i = 1&lt;br&gt;
            &#039; Split AA(1) into digits&lt;br&gt;
            Do While AA(i) .GT. 9&lt;br&gt;
                AA(i + 1) = AA(i)&lt;br&gt;
                AA(i) = AA(i) Mod 10&lt;br&gt;
                AA(i + 1) = Int(AA(i + 1) / 10)&lt;br&gt;
                i = i + 1&lt;br&gt;
            Loop&lt;/p&gt;
&lt;p&gt;            BA(1) = 5&lt;br&gt;
            j = 1&lt;/p&gt;
&lt;p&gt;            Do While j .LT=. Dig + 1&lt;/p&gt;
&lt;p&gt;                &#039; Check if a .GT=. b&lt;br&gt;
                If i = j Then&lt;br&gt;
                    k = i&lt;br&gt;
                    Do While AA(k) = BA(k)&lt;br&gt;
                        k = k - 1&lt;br&gt;
                    Loop&lt;br&gt;
                    If AA(k) .GT=. BA(k) Then BigVal = 1 Else BigVal = 2&lt;br&gt;
                Else&lt;br&gt;
                    If i .GT. j Then BigVal = 1 Else BigVal = 2&lt;br&gt;
                End If&lt;/p&gt;
&lt;p&gt;                If BigVal = 1 Then&lt;br&gt;
                &#039; a .GT=. b&lt;br&gt;
                    For k = 1 To i&lt;br&gt;
                        AA(k) = AA(k) - BA(k)&lt;br&gt;
                        If AA(k) .LT. 0 Then&lt;br&gt;
                            AA(k) = AA(k) + 10&lt;br&gt;
                            AA(k + 1) = AA(k + 1) - 1&lt;br&gt;
                        End If&lt;br&gt;
                    Next k&lt;/p&gt;
&lt;p&gt;                    Do While AA(i) = 0&lt;br&gt;
                        i = i - 1&lt;br&gt;
                    Loop&lt;/p&gt;
&lt;p&gt;                    BA(2) = BA(2) + 1&lt;br&gt;
                    If j = 1 Then j = 2&lt;br&gt;
                    If BA(2) .GT. 9 Then&lt;br&gt;
                        k = 2&lt;br&gt;
                        Do While BA(k) .GT. 9&lt;br&gt;
                            BA(k + 1) = BA(k)&lt;br&gt;
                            BA(k) = BA(k) Mod 10&lt;br&gt;
                            BA(k + 1) = Int(BA(k + 1) / 10)&lt;br&gt;
                            k = k + 1&lt;br&gt;
                        Loop&lt;br&gt;
                        If k .GT. j Then j = k&lt;br&gt;
                    End If&lt;br&gt;
                Else&lt;br&gt;
                &#039; b .GT. a&lt;br&gt;
                    For k = i + 2 To 3 Step -1&lt;br&gt;
                        AA(k) = AA(k - 2)&lt;br&gt;
                    Next k&lt;br&gt;
                    AA(2) = 0&lt;br&gt;
                    AA(1) = 0&lt;br&gt;
                    i = i + 2&lt;/p&gt;
&lt;p&gt;                    For k = j + 1 To 3 Step -1&lt;br&gt;
                        BA(k) = BA(k - 1)&lt;br&gt;
                    Next k&lt;br&gt;
                    BA(2) = 0&lt;br&gt;
                    j = j + 1&lt;br&gt;
                End If&lt;br&gt;
            Loop&lt;/p&gt;
&lt;p&gt;        &#039; Find sum of digits&lt;br&gt;
            For j = Dig + 2 To Dig - 97 Step -1&lt;br&gt;
                SumDig(1, 1) = SumDig(1, 1) + BA(j)&lt;br&gt;
            Next j&lt;br&gt;
        End If&lt;/p&gt;
&lt;p&gt;    Next n&lt;br&gt;
    SumDig(1, 2) = Timer - SumDig(1, 2)&lt;br&gt;
    SqRtI = SumDig&lt;br&gt;
End Function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>OK, did it with arrays.  I was tempted to use an array of 10 digit integers, to save memory, but it makes it much simpler to have one digit for each array location.</p>
<p>Fairly straightforward with the help of Prof. Jarvis.  Run time = about 0.3 sec <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Function SqRtI(val As Long, Dig As Double) As Variant<br />
    Dim AA() As Long, BA() As Long, Digp As Long<br />
    Dim SumDig(1 To 1, 1 To 2) As Double<br />
    Dim i As Long, j As Long, k As Long, NumDig As Long<br />
    Dim BigVal As Long, dStep As Long, n As Long</p>
<p>    SumDig(1, 2) = Timer<br />
    Digp = Dig + 10</p>
<p>    For n = 2 To val<br />
        If n ^ 0.5 .NE. Int(n ^ 0.5) Then<br />
            ReDim AA(1 To Digp)<br />
            ReDim BA(1 To Digp)</p>
<p>            AA(1) = n * 5<br />
            i = 1<br />
            &#8216; Split AA(1) into digits<br />
            Do While AA(i) .GT. 9<br />
                AA(i + 1) = AA(i)<br />
                AA(i) = AA(i) Mod 10<br />
                AA(i + 1) = Int(AA(i + 1) / 10)<br />
                i = i + 1<br />
            Loop</p>
<p>            BA(1) = 5<br />
            j = 1</p>
<p>            Do While j .LT=. Dig + 1</p>
<p>                &#8216; Check if a .GT=. b<br />
                If i = j Then<br />
                    k = i<br />
                    Do While AA(k) = BA(k)<br />
                        k = k &#8211; 1<br />
                    Loop<br />
                    If AA(k) .GT=. BA(k) Then BigVal = 1 Else BigVal = 2<br />
                Else<br />
                    If i .GT. j Then BigVal = 1 Else BigVal = 2<br />
                End If</p>
<p>                If BigVal = 1 Then<br />
                &#8216; a .GT=. b<br />
                    For k = 1 To i<br />
                        AA(k) = AA(k) &#8211; BA(k)<br />
                        If AA(k) .LT. 0 Then<br />
                            AA(k) = AA(k) + 10<br />
                            AA(k + 1) = AA(k + 1) &#8211; 1<br />
                        End If<br />
                    Next k</p>
<p>                    Do While AA(i) = 0<br />
                        i = i &#8211; 1<br />
                    Loop</p>
<p>                    BA(2) = BA(2) + 1<br />
                    If j = 1 Then j = 2<br />
                    If BA(2) .GT. 9 Then<br />
                        k = 2<br />
                        Do While BA(k) .GT. 9<br />
                            BA(k + 1) = BA(k)<br />
                            BA(k) = BA(k) Mod 10<br />
                            BA(k + 1) = Int(BA(k + 1) / 10)<br />
                            k = k + 1<br />
                        Loop<br />
                        If k .GT. j Then j = k<br />
                    End If<br />
                Else<br />
                &#8216; b .GT. a<br />
                    For k = i + 2 To 3 Step -1<br />
                        AA(k) = AA(k &#8211; 2)<br />
                    Next k<br />
                    AA(2) = 0<br />
                    AA(1) = 0<br />
                    i = i + 2</p>
<p>                    For k = j + 1 To 3 Step -1<br />
                        BA(k) = BA(k &#8211; 1)<br />
                    Next k<br />
                    BA(2) = 0<br />
                    j = j + 1<br />
                End If<br />
            Loop</p>
<p>        &#8216; Find sum of digits<br />
            For j = Dig + 2 To Dig &#8211; 97 Step -1<br />
                SumDig(1, 1) = SumDig(1, 1) + BA(j)<br />
            Next j<br />
        End If</p>
<p>    Next n<br />
    SumDig(1, 2) = Timer &#8211; SumDig(1, 2)<br />
    SqRtI = SumDig<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/04/25/euler-problem-80/#comment-39142</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Sun, 26 Apr 2009 00:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2378#comment-39142</guid>
		<description>&lt;p&gt;Interesting problem.  Partly prompted by Project Euler, I&#039;m starting to learn Python, and I suspect that this problem would be dead simple in Python, but then it wouldn&#039;t be interesting any more.  I&#039;ll have a go at it with arrays of longs instead of strings and see how that goes.&lt;/p&gt;
&lt;p&gt;I might have a go at a spreadsheet based solution as well.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Interesting problem.  Partly prompted by Project Euler, I&#8217;m starting to learn Python, and I suspect that this problem would be dead simple in Python, but then it wouldn&#8217;t be interesting any more.  I&#8217;ll have a go at it with arrays of longs instead of strings and see how that goes.</p>
<p>I might have a go at a spreadsheet based solution as well.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

