<?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: Russian Peasant Multiplication</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 23:42:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Bob Phillips</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40641</link>
		<dc:creator>Bob Phillips</dc:creator>
		<pubDate>Fri, 14 Aug 2009 09:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40641</guid>
		<description>&lt;p&gt;Spreadsheet formula.&lt;/p&gt;
&lt;p&gt;=A1*B1&lt;/p&gt;
&lt;p&gt;If you have a modern spreadsheet, absolutetly no need to conform to the old ways.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Spreadsheet formula.</p>
<p>=A1*B1</p>
<p>If you have a modern spreadsheet, absolutetly no need to conform to the old ways.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lizz</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40617</link>
		<dc:creator>Lizz</dc:creator>
		<pubDate>Thu, 13 Aug 2009 16:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40617</guid>
		<description>&lt;p&gt;Ah, that makes sense, thank you :o)  I hadn&#039;t realised the original numbers were included.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ah, that makes sense, thank you <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )  I hadn&#8217;t realised the original numbers were included.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40615</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Thu, 13 Aug 2009 14:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40615</guid>
		<description>&lt;p&gt;Yeah, I was thinking that the first number would only be odd once.  But that&#039;s clearly not true.  I have no excuse as I was sober when I wrote this post.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Yeah, I was thinking that the first number would only be odd once.  But that&#8217;s clearly not true.  I have no excuse as I was sober when I wrote this post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Phillips</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40612</link>
		<dc:creator>Bob Phillips</dc:creator>
		<pubDate>Thu, 13 Aug 2009 14:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40612</guid>
		<description>&lt;p&gt;Lizz,&lt;/p&gt;
&lt;p&gt;You have missed the other odd element in the list.&lt;/p&gt;
&lt;p&gt;It decomposes to&lt;/p&gt;
&lt;p&gt;1923&lt;br&gt;
946&lt;br&gt;
492&lt;br&gt;
2184&lt;br&gt;
1368&lt;/p&gt;
&lt;p&gt;so you add all of the odds, 368+46+23. You seem to have missed the starting element which is also odd.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Lizz,</p>
<p>You have missed the other odd element in the list.</p>
<p>It decomposes to</p>
<p>1923<br />
946<br />
492<br />
2184<br />
1368</p>
<p>so you add all of the odds, 368+46+23. You seem to have missed the starting element which is also odd.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lizz</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40611</link>
		<dc:creator>Lizz</dc:creator>
		<pubDate>Thu, 13 Aug 2009 13:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40611</guid>
		<description>&lt;p&gt;I&#039;ve tried doing this in a plain spreadsheet (and I&#039;m not that great at maths so I may have missed something), but it seems to only work if the number being divided is even.  It gets the wrong answer if it&#039;s odd.&lt;/p&gt;
&lt;p&gt;So 19 * 23 comes out using this method:&lt;/p&gt;
&lt;p&gt;19X23=437&lt;/p&gt;
&lt;p&gt;94646&lt;br&gt;
492&lt;br&gt;
2184&lt;br&gt;
1368368&lt;br&gt;
414&lt;/p&gt;
&lt;p&gt;Have I misunderstood this completely?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve tried doing this in a plain spreadsheet (and I&#8217;m not that great at maths so I may have missed something), but it seems to only work if the number being divided is even.  It gets the wrong answer if it&#8217;s odd.</p>
<p>So 19 * 23 comes out using this method:</p>
<p>19X23=437</p>
<p>94646<br />
492<br />
2184<br />
1368368<br />
414</p>
<p>Have I misunderstood this completely?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40606</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Thu, 13 Aug 2009 05:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40606</guid>
		<description>&lt;p&gt;The best I can do...&lt;/p&gt;
&lt;p&gt;Array formula in Excel:&lt;br&gt;
=SUM(IF(MOD(INT(G9/2^(-1+ROW(INDIRECT(&quot;1:&quot;&amp;CEILING(LOG(G9)/LOG(2),1))))),2)=1,G10*INT(2^(-1+ROW(INDIRECT(&quot;1:&quot;&amp;CEILING(LOG(G9)/LOG(2),1)))))))&lt;br&gt;
where G9 and G10 contain the numbers to be multiplied.&lt;/p&gt;
&lt;p&gt;and in VBA&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Option&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Explicit&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; RussianPeasant(&lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; Int1 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, &lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; Int2 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Int1 = 0 &lt;span class=&quot;kw1&quot;&gt;Or&lt;/span&gt; Int2 = 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; SignMult &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;: SignMult = Sgn(Int1) * Sgn(Int2)&lt;br&gt;
&#160; &#160; Int1 = Abs(Int1): Int2 = Abs(Int2)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; RussianPeasant = RussianPeasant + IIf(Int1 &lt;span class=&quot;kw1&quot;&gt;Mod&lt;/span&gt; 2 = 1, Int2, 0)&lt;br&gt;
&#160; &#160; &#160; &#160; Int2 = Int2 * 2: Int1 = Int1  2&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Until&lt;/span&gt; Int1 = 0&lt;br&gt;
&#160; &#160; RussianPeasant = RussianPeasant * SignMult&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>The best I can do&#8230;</p>
<p>Array formula in Excel:<br />
=SUM(IF(MOD(INT(G9/2^(-1+ROW(INDIRECT(&#8220;1:&#8221;&amp;CEILING(LOG(G9)/LOG(2),1))))),2)=1,G10*INT(2^(-1+ROW(INDIRECT(&#8220;1:&#8221;&amp;CEILING(LOG(G9)/LOG(2),1)))))))<br />
where G9 and G10 contain the numbers to be multiplied.</p>
<p>and in VBA</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Option</span> <span class="kw1">Explicit</span></p>
<p><span class="kw1">Function</span> RussianPeasant(<span class="kw1">ByVal</span> Int1 <span class="kw1">As</span> <span class="kw1">Long</span>, <span class="kw1">ByVal</span> Int2 <span class="kw1">As</span> <span class="kw1">Long</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">If</span> Int1 = 0 <span class="kw1">Or</span> Int2 = 0 <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Function</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> SignMult <span class="kw1">As</span> <span class="kw1">Integer</span>: SignMult = Sgn(Int1) * Sgn(Int2)<br />
&nbsp; &nbsp; Int1 = Abs(Int1): Int2 = Abs(Int2)<br />
&nbsp; &nbsp; <span class="kw1">Do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; RussianPeasant = RussianPeasant + IIf(Int1 <span class="kw1">Mod</span> 2 = 1, Int2, 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; Int2 = Int2 * 2: Int1 = Int1  2<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Loop</span> <span class="kw1">Until</span> Int1 = 0<br />
&nbsp; &nbsp; RussianPeasant = RussianPeasant * SignMult<br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40603</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Thu, 13 Aug 2009 02:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40603</guid>
		<description>&lt;p&gt;Dick - your code doesn&#039;t always give the right answer. The line:&lt;br&gt;
lMod = lMult&lt;br&gt;
should be&lt;br&gt;
lMod = lMult + lMod&lt;/p&gt;
&lt;p&gt;Here&#039;s my effort:&lt;/p&gt;
&lt;p&gt;Function RPMult(Num1 As Long, Num2 As Double) As Double&lt;br&gt;
Do While Num1 &gt;= 1&lt;br&gt;
If Num1 Mod 2 = 1 Then RPMult = RPMult + Num2&lt;br&gt;
Num1 = (Num1  2)&lt;br&gt;
Num2 = Num2 * 2&lt;br&gt;
Loop&lt;br&gt;
End Function&lt;/p&gt;
&lt;p&gt;I made Num2 a double so it didn&#039;t overflow so quickly.&lt;br&gt;
I&#039;ll be intrerested to see the worksheet approach (I had a think about it, but my brain crashed).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick &#8211; your code doesn&#8217;t always give the right answer. The line:<br />
lMod = lMult<br />
should be<br />
lMod = lMult + lMod</p>
<p>Here&#8217;s my effort:</p>
<p>Function RPMult(Num1 As Long, Num2 As Double) As Double<br />
Do While Num1 &gt;= 1<br />
If Num1 Mod 2 = 1 Then RPMult = RPMult + Num2<br />
Num1 = (Num1  2)<br />
Num2 = Num2 * 2<br />
Loop<br />
End Function</p>
<p>I made Num2 a double so it didn&#8217;t overflow so quickly.<br />
I&#8217;ll be intrerested to see the worksheet approach (I had a think about it, but my brain crashed).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark nold</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40601</link>
		<dc:creator>mark nold</dc:creator>
		<pubDate>Thu, 13 Aug 2009 01:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40601</guid>
		<description>&lt;p&gt;Something looks wrong with your function... have you tested RussianPeasant(99, 100) ?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Something looks wrong with your function&#8230; have you tested RussianPeasant(99, 100) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/08/12/russian-peasant-multiplication/#comment-40597</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Wed, 12 Aug 2009 22:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2819#comment-40597</guid>
		<description>&lt;p&gt;&lt;a href=&quot;http://thedailywtf.com/Comments/Programming-Praxis-Russian-Peasant-Multiplication.aspx?pg=14#279306&quot; rel=&quot;nofollow&quot;&gt;This guy&lt;/a&gt; did it in one line.  I&#039;ll post a spreadsheet formula solution tomorrow.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><a href="http://thedailywtf.com/Comments/Programming-Praxis-Russian-Peasant-Multiplication.aspx?pg=14#279306" rel="nofollow">This guy</a> did it in one line.  I&#8217;ll post a spreadsheet formula solution tomorrow.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

