Sie sind auf Seite 1von 9

1

Novel Alsgorithm for N


th
Root of Number using Multinomial Expansion
Vitthal B. Jadhav
Pune, Maharashtra, India.
Email: jadhavvitthal1989@gmail.com
ABSTRACT
This paper gives general algorithm to extract n
th
root of any real number . Algorithm
uses multinomial expansion and intelligent guessing to compute digits of root. Paper also
discusses various novel approaches to expand multinomial.
KEYWORD
Algorithm, N
th
Root, Multinomial Expansion , Intelligent Guessing , Integer Partition
PREREQUISITE
1) Binomial and multinomial theorem
GENERAL METHOD
Different method or approaches, based on multinomial expansion, can be used to extract
n
th
root of any real number. But first we restrict ourselves only with computing n
th
root of
perfect n
th
power. Afterword general algorithm is given to extract n
th
root of any number.
1) BACKWARD APPROACH
Example
1
3
(149721291) ? (Given 149721291 perfect cube) =
To calculate cube root, first divide given cube into3 digit group from right to left.
i.e. Given cube = 149 721 291
No. of digit = No. of groups = 3
Let integer , , a b c be unit , tens and hundred place of 3 digit cube root respectively.
0 , 9 , 1 9 a b c
Now expanding cube of 10 100 cba a b c = + + in power of 10s , we get
i.e.
3 3 2 2 2 2
( 10 100 ) ( 3 *10 (3 3 )10 ....... a b c a a b ab a c + + = + + + +
Let higher terms in RHS that are multiple of
3
10 be 1000Y, then

2

3 3 2 2 2 2
( 10 100 ) 3 *10 (3 3 )10 1000 a b c a a b ab a c Y + + = + + + +
Now given cube = 150568768
3 2 2 2 2
3 *10 (3 3 )10 1000 150568768 a a b ab a c Y + + + + =

3 2 2 2 2
3 *10 (3 3 )10 1000 149721291 a a b ab a c Y + + + + =

2 2 2 2 3
3 *10 (3 3 )10 1000 149721291 a b ab a c Y a + + + = -------------(1)
As LHS is multiple of 10, So RHS
3
149721291 a must be divisible by 10

3
149721291 a must ends with 0 i.e.
3
a must ends with 1.
Now there is only one integer i.e. 1 between 0 to 9 whose cube end with 1 , a=1
Substituting a=1 in above equation (1)

2 2 2 2
3 *10 (3 3 )10 1000 149721291 1 149721290 a b ab a c Y + + + = =

2 2 2
3 (3 3 )10 100 14972129 a b ab a c Y + + + = (Dividing both side by 10)
Similarly,

2 2 2
(3 3 )10 100 14972129 3 ab a c Y a b + + =
LHS is multiple of 10
2
3a b =3b must ends with 9 b=3

2 2
2 2
2 2 2 2
(3 3 )10 100 14972129 3*3 14972120
(3 3 ) 10 1497212
10 1497212 (3 3 ) 1497212 (3*1*3 3*1 * )
10 1497185 3
LHS divisible by 10 3 must ends with 5 and 1 c 9 c =5
ab a c Y
ab a c Y
Y ab a c c
Y c
c
+ + = =
+ + =
= + = +
=


Cube root= cba= 531





3
In short,
( )
3
3
1) ends with 1 End digit of 149721291
a 1 1 ,Subtracting it from 149721291 and 149721291
eliminating last digit i.e. 149721
a
a = =
290 14972129 1
---------------

=
( )
2
149721290
2) 3 3 ends with 9 End digit of 14972129
b
a b b =
=
2
3 3 9 , Subtracting it from 14972129 and 14972129
eliminating last digit i.e. 14972120 1497212 9

a b =
=
-----------------

( )
2 2
2 2
1497212
3) 3 3 27 3 ends with 2 End digit of 1497212 42
3 ends with 5 c 5 3 3 42 . -----
ab a c c
c ab a c
+ = +
= + = ------------
149717
Cube Root(150568768) 531 cba = =

Applicability
Above method is convenient to extract n
th
root of perfect n
th
power that
satisfies

1
(10, * ) 1
n
GCD n U

=

th

(10, ) 1 and GCD(10, U) =1 Where U= Unit digit of n root .
i.e. Unit digits of " n and n root " must be relative prime to 10 (base).
(Why ? T
th
GCD n =
hink ).


2) FORWARD APPROACH
Example 1)
( )
1
th
4
(20352513413376) ? Given number is perfect 4 power =


Steps
1) Arrange given perfect n
th
power into n digit group from right to left.
Here n = 4.
20 3525 1241 3376
No. of groups = 4 No. of digit in root = 4
Let root = 1000 100 10 a b c d + + +



4

Why This Works ?
th
4
( ( ) has only one real positive root -According to Decarte's rule )
(Deca
Let N= 20 3525 1241 3376
x is 4 root of N
( ) = x 20 3525 1241 3376
f x
f x
4 4
4 4 4 12 12 4 12
rtes Rule- Maximum no. of positive root of
( ) No. of sign (coefficient sign) changes in ( ) )

2000 3000
2000
2 20 3 2 *10 20*10 3 *10
f x f x
N
=
<

< <
4 4
0 and 3000 0
i.e. (2000) & (3000)
Between two opposite signs of polynomial there always exist at least one real root.
Root (x) must lies between 2000 and 3000
There
N N
f ve f ve
>
= = +

fore most significant digit of root is 1


Similar reasoning can be given for subsequent steps of this method.
Aryabhata's square root method and many other method indirectly use
this concept for intelligent guessing.
2) Except leftmost group , separate digits of all groups
i.e. 20 3 5 2 5 1 2 4 1 3 3 7 6

3) To extract 4 digit of perfect 4
th
power, Only most significant 4+1 term are
sufficient. Expanding
4
(1000 100 10 ) a b c d + + + according to descending power of
ten using multinomial theorem, we get most significant 5 terms of expansion as

4 4 12 3 11 2 2 3 10
1 3 2 3 9
4 12 3 11 2 2 3 10
1 3 2 3 9
4! 4! 4!
(1000 100 10 ) ( ) *10 ( ) *10 ( ) *10
3!1! 2!2! 3!1!
4! 4! 4!
( ) *10 .........
1!3! 2!1!1! 3!1!
( ) *10 (4 ) *10 (6 4 )*10
+ (4 12 4 ) *10 ...
a b c d a a b a b a c
a b a bc a d
a a b a b a c
a b a bc a d
+ + + = + + +
+ + + + +
= + + +
+ + + .

4) Now highest
4
a
less than or equal to 20 is
4
2 16 2. a = =

Subtract
4
a from leftmost group and attach subtraction before next digit to
get next gross dividend.
2
i.e. 20
4
3 5 2 5 1 2 4 1 3 3 7 6

















5
5) Now look up for highest integer b such that
3
(4 ) 4*8* 32 a b b b = = less than or equal
to 43
i.e. 32 43 b 1 b=1 b Highest
subtracting
3
4 32 a b = from 43 , we get 11. Attach 11 before next digit 5 to get
next gross dividend 115.
2 1
i.e. 20
4
3
11
5 2 5 1 2 4 1 3 3 7 6

6) Look for highest integer c such that
2 2 3
(6 4 ) a b a c + less than or equal to gross
dividend 115.
i.e.
2 2 3
(6 4 ) 115 24 32 115 a b a c c + +

32 91 c=2 c
Subtracting
2 2 3
(6 4 ) a b a c + from 115, we get 9164 = 27, attaching it before next
digit 2 to get next gross dividend.

2 1 2
i.e. 20
4
3
11
5
27
2 5 1 2 4 1 3 3 7 6

7) Similarly,
1 3 2 3
4 12 4 272 a b a bc a d + +

8 96 32 272 32 168
4
d d
d
+ +
=

Subtracting
1 3 2 3
(4 12 4 ) a b a bc a d + + from 272, we get 168128 = 40, attaching it
before next digit 5 to get next gross dividend.
2 1 2 4
i.e. 20
4
3
11
5
27
2
40
5 1 2 4 1 3 3 7 6


1
4
(20352513413376) 2124 =
Applicability
Above method is applicable to extract n
th
root of any number.



6
3) FORWARD BACKWARD APPROACH
( )
1
th
7
1) (19477056866406726525123713030989808121) ? Given number is perfect 7 power =
Arranging number into 7 digit group from right to left

194 7705686 6406726 5251237 1303098 9808121
No. of digit in 7
th
root = No. of groups = 6.
Let abcdef = f + 10e + 100d+ 1000c + 10000b + 100000a be root.
Here we can extract 4 least significant digit cdef by backward approach as below
2 3 4 5 7 7 6 5 2 6 2
4 3 5 6 3 7 35
( 10 10 10 10 10 ) (7 ) *10 (21 7 )*10
(28 21 7 )*10 ....... *10
f e d c b a f f e f e f d
f e f ed f d a
+ + + + + = + + +
+ + + + +

( )
7
7
1) ends with 1 End digit of 19477056866406726525123713030989808121
f 1 1 , Subtracting it from ...08121, ..
f
f = = ....08121
and eliminating last digit 1

------------------------

( )
6
6
.......08120
2) 7 7 ends with 2 End digit of ...812
6 7 42 , Subtracting it from ...812 ......081
f e e
e f e
=
= = 2
and eliminating last digit . 42

----------------------

( )
5 2 6
.....0770
3) 21 7 756 7 ends with 7 End digit of ...77
7 ends with 7-6=1 d 3 756+7d 777, ......8077
Su
f e f d d
d
+ = +
= =
btracting it from ...8077 and eliminating last digit . 777

4 3 5
----------------------
.....3700
4) 28 21 f e f + ( )
6
7 28*216 21*18 7 ends with 0 End digit of ...370
7 ends with =4 c 2
cdef 2361 -------
ed f c d
c
+ = + +
=
= -------------------(1)
Now we extract most significant 2 digit i.e. ab by forward approach as below

5 4 3 2 7 7 35 6 34 5 2 6 33 7
(10 10 10 10 10 ) ( ) *10 (7 ) *10 (21 7 ) *10 ....... a b c d e f a a b a b a c e + + + + + = + + + + +

2 1 3
i.e. 194
66
7
219
7
181
0 5 6 8 ....... 8 1 2 1

7
I. Initialization

2 1 0
1 2 1 0
1 2 3
th
Number to extract n root
(Number in decimal notation)
( Arranging digits of number N
......

=

1)
= ...

m
m m
mn n mn n mn n
D D D D D D
G G G GG
N

+ + +
=
1 2
2 2 1 0
1
1 2 1 0
into 'n digit group' from right to left)
(10 10 .... 10 10 )
th
MSB (R) = Highest n power of integer th
Assume R

= ( )

... 2)
3)
m m
m m
n
m m m
a a a a a
a
m
N a a a a a


+ + + + +
=
= =
1
0
at is less than or equal to
Divisor
R ( )
n * ( )
4)
5)
n
n
m m
m
G
m
G a
a

=
=


GENERIC ALGORITHM

i)
7
194 2 a a =

7
194 194 128 66 a = =
ii)
6
6
667
7 667 1
7*2
] [ a b b b =

6
667 7 667 448 219 a b = =

iii)
5 2 6
21 7 2197 a b a c +

5 2 6
21*32*1 448 2197 448 (2197 672)
1525
[ ] 3
448
2197 21 7 1525 448*3
1525
Remainder( )=181
448
c c
c c
a b a c
+
=
+ =
=

0 < (c =3 ) < 10 value of b is correct.
21 -----------------------(2) ab =

1
7
(19477056866406726525123713030989808121) 212361 abcdef = =
( From equation (1) and (2) )











II. Iteration
1
1 1
to c
)
For
GD R *10
ND ( )
( )
( k = 1 to m )
, ,....., , ,.....,
i)
ii)
{
k
k
k
k m k
m m m m
k
k
where
D
GD a a a
a a a a a a
C
C


+ =
=
oefficient of 10
It is given as below
mn k


1 1
1 1
( ) 1 /
R = R + Divisor
ND 0 //

iii) if ( )
{

m k m k
k k
k
a a
+ +

=
<
Quotient
Remainder

R
Continue same iteration


}
iv)
m k
k
a

=
=
}

FUTURE ENHANCEMENT
In above algorithm, we
1 2 2
1 2 2 1 0
(10 10 10 .... 10 10 )
m m m n
m m m
a a a a a a


+ + + + + +
1 1
( ) , ,.....,
m m m k
k
a a a C
+
.
listed as below
1) Recursive Approach
Use binomial theorem or
1 1
1 1 1 1
denotes total contribution of ( )
ND ( )
( )
, ,.....,
, ,....., , ,.....,
i)
mn k
m m k m k
m m m m m k m k
D
GD a a a
a a a a a a

+
+ +
+
1 2 2
1 2 2 1 0
oefficient of 10 in expansion . (10 10 10 .... 10 10 )

m m m n
m m m
mn k
a a a a a a


+ + + + + +
1 1
1 1
Validation
/ Decrease Last computed Quotient by 1 ( ) 1 /
R = R + Divisor
ND 0 // iii) if ( )
m k m k
k k
a a
+ +

=
/ Go to step (i) to recompute ND
Quotient
Remainder

/

Continue same iteration
( )
( ) ( ) %
[ ]
k
k k
k
Divisor Divisor
Divisor
ND ND
ND
ND Diviso
=
= r
ENHANCEMENT
In above algorithm, we need to expand multinomial
1 2 2
1 2 2 1 0
(10 10 10 .... 10 10 )
m m m n
m m
a a a a a a

+ + + + + + to compute
( ) . Multinomial can be expanded using various approach that are
Use binomial theorem or Pascal triangle recursively to expand multinomial.

8
1 1 1 1
denotes total contribution of ( ) , ,....., , ,.....,
m m m m m k m k
a a a a a a
+ +
1 2 2
1 2 2 1 0
in expansion . (10 10 10 .... 10 10 )
m m m n
m m
a a a a a a

+ + + + + +
/ Decrease Last computed Quotient by 1 ( ) 1 /
/ Go to step (i) to recompute ND
k

to compute
ultinomial can be expanded using various approach that are
to expand multinomial.

9

2) Algorithmic Approach
Develop or use existing integer processing based faster algorithm to break given
integer power i.e. n into at most m positive integer i.e.
1 0
) ( , ,.....,
m m
p p p

such
that
0 1 2 3 1
0* 1 2 3 .... ( 1)
m m
P P P P m P mP L

+ + + + + + =
In other word , develop efficient algorithm to determine all possible tuple

0 1 2
...., ( , , , )
m
p p p p to solve

0 1 2
...
m
p p p p n + + + + =

1 2 3 1
L
2 3 .... ( 1) 0
k
m m
k
P P P m P mP L k P

+ + + + + =
After computing tuple ,
1 1
( ) , ,.....,
m m m L
L
a a a C
+
can be easily obtained by
using multinomial theorem. Organise tuple and use relation between two tuple to
avoid repetitive factorial computation.
3) Elimination and Retention Approach
Elimination and retention approach provides elegant, systematic way to expand
multinomial. This method will be explored in upcoming book Modern Approach to
Speed Math Secrets. Note that all these algorithm and method for expansion of
multinomial are also useful to compute any integer power of any number. Thus in
future one can enhance this method by developing efficient algorithm to expand
multinomial.
REFERENCES
[1] Bharati Krsna Tirthaji Maharaja, Vedic Mathematics, Motilal Banarasidas Publisher,
Delhi, 1994.
[2] Donald E. Knuth. Generating all n-tuples, 2004. Pre-fascicle 2A of The Art of Computer
Programming A draft of section 7.2.1.1.
http://www-cs-faculty.stanford.edu/knuth/fasc2a.ps.gz.
[3] Antoine Zoghbiu , Ivan Stojmenovic , Fast Algorithms for Generating Integer
Partitions , Intern. Journal of Computer Math., Vol- 70. pp. 319- 332, 1998.
[4] Zoghbi A. (1993), Algorithms of Generating Integer Partition , M . S. Thesis,
University of Ottawa.
[5] Number partition theory http://en.wikipedia.org/wiki/Partition_(number_theory)

Das könnte Ihnen auch gefallen