Re: Russian Peasant Multiplication / was question on
- To: mathgroup at smc.vnet.net
- Subject: [mg131408] Re: Russian Peasant Multiplication / was question on
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Wed, 3 Jul 2013 05:02:26 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <kqm6u7$hp5$1@smc.vnet.net>
x = RandomInteger[{-1000000, 1000000}]
99333
id = IntegerDigits[x]
{9, 9, 3, 3, 3}
pwr10 = 10^Range[Length[id] - 1, 0, -1]
{10000, 1000, 100, 10, 1}
id*pwr10
{90000, 9000, 300, 30, 3}
x ==
Sign[x]*id.pwr10 ==
Sign[x]*Dot[id, pwr10] ==
Sign[x]*Total[id*pwr10] ==
Sign[x]*Plus @@ (id*pwr10)
True
Bob Hanlon
On Tue, Jul 2, 2013 at 12:49 AM, <d.a.paxton at gmail.com> wrote:
> On Saturday, June 29, 2013 2:47:03 AM UTC-6, Richard Fateman wrote:
> > Dave --
> >
> > 1. You should try to come up with a useful subject line
> >
> > in the future.
> >
> > 2. It is called Russian Peasant Multiplication (which you may
> >
> > find on Google).
> >
> > 3. There is no reason to believe that a procedural algorithm
> >
> > has a formula, but in this case I think the inverse is known
> >
> > as division :)
>
> Bob, Thanks on that. I see the use of the floor function. This whole
> idea is trivial when one can use that. What I am trying to do is basically
> do the floor function as a linear equation. This is useful for pulling
> numbers apart. Like a number 13. How does one algebraically make it 1 and
> 3 or 10 and 3. Either.
>
>