A Novel Multiplication Algorithm Based On Euclidean Division For Multiplying Moderately Huge Numbers
1. A novel multiplication algorithm based on Euclidean division for
multiplying moderately huge numbers
Shabir Ahmad Mirβ
Division of Veterinary Pharmacology & Toxicology,
Sher-e-Kashmir University of Agricultural Sciences & Technology
of Kashmir, Shuhama, Srinagar-190001, Kashmir, India
β
Superannuated April 2014. Correspondence address: Professor S.A. Mir, Zari-Mohalla, Lal Bazar-190023,
Srinagar, Kashmir, India; mirsamir.19@rediffmail.com; ORCID identifier: 0000-0002-8169-3667; 2010 AMS Math-
ematics Subject Classification: 11Y99, 11Z05
2. Abstract: Euclidean division algorithm (EDA) forms a core procedure in elementary number
theory with numerous applications mainly to: (i) determine gcd of two integers, and (ii) find
multiplicative inverse of two integers to solve linear Diophantine equations, CRT or other needs of
modular arithmetic including its central use in RSA cryptosystems. The present work
demonstrates a remarkable application of the technique for multiplying any two integers. The
technique is applied directly when the multiplying integers are dissimilar, and is used with some
modification when the multipliers are identical where EDA is otherwise impractical to use. The
finding is lent support by the known property of Fibonacci-like numbers wherein the product of
any two consecutive Fibonacci or Lucas numbers is defined in terms of sum of squares of lesser
terms. A non-recursive python implementation algorithm of the procedure has revealed that the
same can handle multiplication of moderately huge integers having decimal digit sizes (DDS) from
tens of thousands through to a million digits. The procedure is inherently suited for multiplying
unequal sized integers, that feature is missing in currently employed multiplication protocols. The
finding is expected to have both academic and practical implications in elementary number theory.
Key words: Euclidean division algorithm, new multiplication scheme, Fibonacci and Lucas
numbers, integer property
1 Introduction
Euclidean division algorithm (EDA) has a pivotal role in number theory [7, 5, 2]. It elucidates
divisibility property of integers, and aids in their characterization as odd, even, prime, co-prime
and composite types. Two principal applications are served by providing gcd of two integers, and
in its extended form for finding modular inverses for solving congruence equations in one or two
unknown variables including Diophantine type linear equations and in applications of Chinese
remainder theorem. RSA based cryptosystems are fundamentally dependent on its applications to
define private and public keys for encryption and decryption to enable safe and secure digital
handling of data and financial transactions[6]. Whereas EDA is primarily studied in elucidating
divisibility properties of integers, however the same has been found, as supported by the present
work, to aid exposition of multiplicative property for the integers.
2 Multiplication scheme based on Euclidean division algorithm
Let x and y be two integers with x > y > 0. A typical EDA includes repeated division of two
given integers employing at first step division of larger member x as dividend by smaller member
y as divisor. The process of division(s) is continued repeatedly while using remainder from
previous division as divisor to divide previous divisor treating that as dividend. The division
process is terminated when finally the remainder is zero. As apparent, all steps baring the first
2
3. division involve only remainders those are generated sequentially over the continued process. At
each division two integers are obtained, quotient and remainder. Multiplication process uses these
pairs of quotient and remainder, collected over repeated divisions, to compute the product from
multiplying x and y . The process is continued depending upon the magnitudes of two numbers.
When two numbers are different in magnitudes, then algorithm is directly applied as if their gcd
is being determined. However, if two numbers are identical then EDA can not be applied directly.
A simple modification is introduced to modify the multipliers to enable accomplishment of results
with ease and without introducing any error. The procedure is accordingly explained through two
examples. First example (Table 1) illustrates the case when the two numbers are dissimilar in
magnitude and the product constitutes xy. The second example (Table 2) demonstrates how to
apply the procedure, EDA cum multiplication, when the two integers are identical in magnitude,
and the product defines x2.
Case 1 : Two multipliers are different in magnitude x 6= y, x > y > 0, product = xy
Given x is subjected to division by y as per procedure of EDA till remainder is zero. At each
stage, pair of divisor di and quotient qi are collected wherein 1 β€ i β€ n, and n defines number of
divisions required from start to end of EDA. Then product is defined by:
xy =
n
X
i=1
d2
i β qi x > y, 1 β€ i β€ n (1)
Table 1 outlines the multiplication of numbers 1234 and 347. For convenience and uniformity, we
will consider larger member as x and smaller member as y. The EDA process will run step-wise
as shown in the table. As is evident, summation of first term of each division is equal to the
product obtained: 428198 = 347*1234.
Case 2 : Two multipliers are identical in magnitude x = y, thus x = x, product = x2
In this case, an arbitrary number is chosen as a factor which is less than given integer. It may be
preferably 2, 3, 4 or any other value but lesser in magnitude than the number to be modified.
Then value k is obtained as a quotient when given integer is subjected to integer division with
chosen factor value. Once choice has been made, and the value k determined, then one member is
obtained by adding k and other member is obtained by subtracting k from the identical integer.
The two modified integers are subjected to EDA . The final value is obtained as per outlined
procedure adopted in case 1, and the result is added k2 to get the actual product. The formula
takes the modified form as under:
xy =
n
X
i=1
d2
i β qi + k2
x > y, k < x, y, 1 β€ i β€ n (2)
To illustrate it by example, let multiply two identical integers: 1234 and 1234. Let us chose a
factor 4 to get an approximated simple number, about one-fourth of the given integer, as k = 300.
The given integer 1234 is modified with k as x = 1234 + 300 = 1534 and y = 1234 β 300 = 934.
Then applying EDA, we get the results as shown in Table 2. The sum obtained in Table 2 :
3
4. 1432756 has to be added k2 = 300 β 300 = 90000 to provide desired product x2.Therefore,
x2 = 12342 = 1432756 + 90000 = 1522756. The modification is simpler to rationalize. By adding
and subtracting k to the member, we have actually converted given x to be squared into two
different integers: (x + k) and (x β k). Their product (x + k)(x β k) = (x2 β k2). The tabular sum
represents this value . However, our original value should correspond to x β x = x2, so tabulated
sum has to be added k2 to get the actual product. A couple of examples will illustrate that the
choice of k does not affect the result. If we take factor close to unity such as 1.03 to get k = 1200
approximately closer to the given number 1234 we get the modified numbers for x and y
respectively as (2434, 34) till remainder is zero are observed as (34, 71), (20, 1), (14, 1), (6, 2), (2, 3).
The computed product is obtained as
71 β 342
+ 202
+ 142
+ 2 β 62
+ 3 β 22
= 82756 + 12002
= 1522756 = 12342
On the other hand if factor choice is 36 then approximate value for k is 1234//36 = 34 and the
pairs of parameters with the modified integers (1268, 1200) are successively obtained as
(1200, 1), (68, 17), (44, 1), (24, 1), (20, 1), (4, 5) yielding final product:
12002
+ 17 β 682
+ 442
+ 242
+ 202
+ 5 β 42
= 1521600 + 342
= 1522756 = 12342
In view of these observations, the cited equation 2 can make general representation of the
inference wherein k2 can be employed uniformly with k = 0 in case x 6= y.
3 Identity with the product of two consecutive Fibonacci-like
terms
Fibonacci-like terms including Fibonacci and Lucas numbers show a remarkable property that is
demonstrated by the product of two consecutive terms that lend support to the proposed
multiplication scheme [1]. To begin with when EDA is applied to any pair of consecutive
Fibonacci numbers, then with each division a progenitor Fibonacci number is generated
sequentially as remainder in that order till termination. EDA aids in converting a pair of
consecutive Fibonacci numbers as generator of all lesser Fibonacci numbers. Each division leaves
quotient 1 throughout till towards penultimate terms when remainder is 2 and 3, respectively, for
Fibonacci and Lucas numbers which upon division by last remainder unity yield corresponding
quotients as 2 and 3 leaving final remainder zero. This has notable consequences for current
concern: (i) rendering the division process a worst type with increased number of divisions (see
later); (ii) the ratio of the consecutive terms tend to converge to golden ratio (value of phi =
1.16180399...) with the result quotient never exceeds integer unity for whatever the magnitude of
two consecutive integers; and (iii) it serves to elucidate the characteristic multiplication function
such that the product of two consecutive is equal to sum of squares of all numbers of lesser
4
5. degree. Since Lucas numbers (L0 = 2, L1 = 1, L2 = 3) are akin to Fibonacci numbers
(F0 = 0, F1 = 1, F2 = 1) with respect to their method of generation and most properties [3, 1], the
results apply to both series. There is a notable difference for addition of last term to the
preceding sums. In case of Fibonacci terms, sum of squares extend up to term third F3 = 2 and
last term added is 2 as product of last divisor 1 and last quotient 2. In case of Lucas numbers,
sum of squares extend up to second term L2 = 3 and last term added is 3 as a product of last
divisor 1 and last quotient 3. Fibonacci-like sequences and their properties have been excellently
described [1] and beautifully illustrated [3]. The proof relating product of two consecutive
Fibonacci terms to sum of squares of lower numbers has been precisely demonstrated [1]. This is
a remarkable property that lends support to the present work, and the two equations for the two
sequences may be put forth as follows:
(Fn+1) β (Fn) =
n
X
i=3
Fi + 2 (3)
(Ln+1) β (Ln) =
n
X
i=2
Li + 3 (4)
4 The rationale for the multiplication scheme based on EDA
The rationale for the multiplication scheme based on EDA is inherently entailed in the expression
defining each division. The dividend at each step of EDA is expressed in terms of divisor,
quotient and remainder. Dividend for each division baring terminal is sum of two terms: one is
product of divisor and quotient and the second is remainder. Each division is either of two
consequences. Case 1 when remainder is zero forms the terminal step in all cases and is the only
step where EDA comprises a single division when dividend is some multiple of divisor. Case 2,
when remainder is more than zero and less than divisor, includes all intermediary steps where
EDA comprises more than one division. When at first division, the dividend treated as
multiplicand is multiplied with divisor to proceed with multiplication algorithm, the two terms
take the form with first term as product of quotient and squared divisor and second term as
product of divisor and remainder. The second term is subsequently subjected to division like
preceding division using remainder as divisor and previous divisor as dividend. This in turn
generates two terms like the first division, and in each case second term takes form of future
divisor and dividend while first term is consistently product of quotient and squared divisor. This
continues till final division when remainder is zero and division generates only one term
(divisor*divisor*quotient). Thus, initial product is simulated as sum of first terms of each division
from beginning to end. Thus, starting EDA with a pair of integers (x, y, x > y > 0), at first step,
x = (y β q1) + r1 with y as first divisor and q1 and r1 as first generation quotient and remainder,
5
6. respectively. Multiplying the dividend with divisor y yields
y β x = y β (y β q1 + r1) = y2
β q1 + y β r1
Next step in EDA involves divisor and first remainder, so second step takes the form as
y = (r1 β q2) + r2 . This multiplied with r1 yields second generation expression
y = r1 β q2 + r2; r1 β y = (r1)2
β q2 + (r1) β (r2)
The second term from second step is subjected to division in an identical manner to define next
expression:
r1 = r2 β q3 + r3; r2 β r1 = (r2)2
β q3 + (r2) β (r3)
The process continues in an identical manner to reach an end when generation of second term is
halted while remainder equals to zero. As apparent, the roles of dividend and divisor are solely
domain of remainders obtained sequentially following first two divisions wherein the former
remainder acts as a dividend and the latest remainder serves as a divisor. The value of remainder
decreases with each division to reach to zero sooner or later depending upon the number of
divisions involved. By converting the EDA into the multiplication scheme, second term is pushed
forward retaining at each step previous product of quotient and squared divisor till remainder
approaches zero. At the end, the product of initial two integers takes the form of continued
summation of first term of each division. Considering d as a uniform representation of divisor of
each division, the whole multiplication process gets summed up as follows, and the summation
gets shortened or lengthened depending upon number of divisions involved or desired:
x β y = (y)2
β q1 + (r1)2
β q2 + (r2)2
β q3 + Β· Β· Β· + (rnβ1)2
β qn =
n
X
i=1
di
2
β qi (5)
5 A python implementation for the proposed multiplication
algorithm
The following code and other python modules were run on python idle (python version 3.5.5
[Anaconda3 custom 32-bit, version 2016]) on Intel Core i3-6100 CPU@3.70 GHz; with cores 2,
threads 4 and 4 GB RAM.
# EDBMA.py [Euclidean division based multiplication algorithm: June, 2019]
import time,os
os.system(βclsβ)
# Choice factors: (range: 2^1 to 2^96): 2, 3, 4, 64, 4096, 16777216,
# 281474976710656, 79228162514264337593543950336
factor = 4096
6
7. #Step 1: input and initial handling
T1=time.perf_counter()
def main(a,b):
if a == b:
k=a//factor
x=a+k
y=a-k
else:
x=max(a,b); y=min(a,b)
count_multiply=0; count_add=0
count_division=0 ; product=0
T2=round(time.perf_counter()-T1,2)
print("Input processing completed in seconds:ta", T2)
#Step 2: product computation
while x>0:
q=x//y ; r=x%y;
square=y*y*q; product=product+square
count_division += 1; count_multiply += 2; count_add +=1
x=y; y=r
if r==0:
break
if a==b:
product=product+k*k
else:
product=product
T3=round(time.perf_counter()-T2,2)
print("Completed product computation in seconds:ta", T3)
#Step 3: integer to string conversion
xyz=str(product)
T4=round(time.perf_counter()-T3,2)
print("String conversion completed in seconds:ta", T4)
#Step 4: copying product as string to text file
file3=open("E://Data//Multiply_EDA.txt", "w")
file3.write(xyz)
file1.close();file2.close();file3.close()
T5=round(time.perf_counter()-T4,2)
print("Product output: E://Data//Multiply_EDA.txt, in seconds :ta", T5)
7
8. print("Multiplication count:ta", count_multiply)
print("Addition count:ta", count_add-1)
print("Divisions count:ta", count_division)
if "__Name__==__main()__":
file1=open("E://Data//Num1.txt", "r")
a=file1.read(); a=int(a)
file2=open("E://Data//Num1m.txt", "r")
b=file2.read(); b=int(b)
main(a,b)
os.system(βclsβ)
Whereas all the steps till remainder is zero are obligatory to be considered for finding gcd of the
two integers, the same is not necessary for employing the EDA for multiplication process. The
number of divisions can be restricted to any convenient level. In that eventuality, it is necessary
to add second term of the final division to the computed summation of all first terms obtained
from undertaken divisions. As will be seen later, the final results are not affected by stopping
pushing forward second term at any of the divisions. The code is modified accordingly
immediately prior to break by replacing βif r ==0:β with lines: if count divisions == 7: product
= product + (x*y); break. The code restricts divisions to 7 only and exits further processing.
6 Preliminary studies on time complexity for multiplying
moderately huge integers
Time complexity findings on EDA have been documented related to the count of divisions. The
same has been mainly linked to the proof provided by Gabriel Lame suggesting that the number
of Euclidean divisions for two positive integers is less than five times the number of digits in the
smaller of the two positive integers [7, 2]1. The bounds for number of steps have been reportedly
documented as less than or equal to (2.078)[logx + 1] where x is the larger of the two positive
integers [7]. In the present study, the number of divisions involving two co-prime multipliers with
DDS-2 through DDS-10 have generally ranged over 6 to 8 steps. These and other random
experiments have yielded r in the range -0.25 to 0.88. However, the number of divisions for EDA
are consistent in certain cases. Division is only one when one member is a multiple of another
member. Divisions are exactly two if two members are consecutive integers or consecutive even
providing remainders, respectively, 1 and 0, and 2 and 0 on first two divisions. Divisions are
exactly three if the pair involves two consecutive odd integers to yield remainders 2, 1 and 0
successively. With widening differences between the pair, the number of included divisions are
1
http://www.robertweaston.com/blog/2016/09/30/fibonacci-numbers-and-the-euclidean-algorithm/
8
9. highly random and variable. As already indicated, the number of divisions reach a limit showing
exactly n divisions when the pair involves two consecutive Fibonacci-like numbers
(Fn+2, Fn+1), n > 1; (Ln+1, Ln), n > 0, and these constitute the worst case scenarios for the
algorithm [1]2. On the other hand if two Fibonacci numbers are more distantly related, lesser
number of divisions are required. To provide a preliminary quantitative assessment with respect
to the proposed multiplication algorithm, a python implementation without involving any
recursive function, was designed to obtain data on number of divisions and time consumption by
various stages while multiplying two integers subjected to EDA. Data were input from text files
holding identical and dissimilar integers over the range DDS-10639 through DDS-1000310. The
computed products were directed to text files. The notepad files were maintained on a separate
drive of hard disk.Test integers over the range covered about 4 through 277 pages of MS Word
document, about DDS-3600 per A4 page with font (Calibri (Body),11 points). Identical input
integers were minimally varied in their values by replacing last ten digits of one member by ten
unity digits. The experiments were carried out in four sets, and each experiment was repeated
thrice. In first experiment, minimally differing integers DDS-10639, DDS-30094, DDS-100260,
DDS-300294, DDS-500155 and DDS-1000310 were subjected to EDA cum multiplication while
keeping track of count of operations, and time periods consumed by various stages. Time periods
in seconds were estimated by time perf counter () function of python with respect to four
parameters : (i) data input and preliminary processing; (ii) computing the integer product; (iii)
converting the integer into string for further handling; and (iv) copying results to the text file.
The data generated were routinely tested by other python modules for verification of the input
and output data. Digit sizes were counted and compared by len(str()) and Notepad++ (ver. 7.7)
in-built() summary function. The program included measure of operations employed during EDA
cum multiplication notably counts of division, addition and multiplication. Second experiment
was conducted with DDS-100260 input as two identical integers, and the pair was modified by
using various integer divisor factors 21 through 296 to generate different k values. Factors enabled
modification of input integers, and to find their relation to number of divisions, and to processing
times. Effect of restricting number of divisions to a convenient level on various processing times
for final output was studied with respect to divisions carried up to remainder zero. In the instant
experiment, DDS-100260 through DDS-1000310 were each input as two identical integers, and
multipliers modified with factor 296. The factor was chosen as it involved maximum number of
divisions (60), and the data was generated while restricting number of divisions to 7 in the
comparable sets. The results of these experiments are given in Tables 3 through 5. The last
experiment was designed to compare efficiency of the proposed method with a tested standard
python implementation based on Karatsuba technique. The Karat method was modified to
exclude zero-padding and recursive function, and to enable handling of unequal-sized multipliers,
2
http://www.math.ualberta.ca/ isaac/math324/s06/euclidean.pdf
9
10. if required.The test was conducted on three integers including DDS-100260, DDS-300294 and
DDS-500155. The inferences drawn from these experiments are briefly outlined for consideration:
1. As a rule, if an experiment required n number of divisions to complete EDA, then number of
multiplications is 2n and the number of additions count to (n β 1). The operations uniformly
include the first step for comparing the input pair for their relative difference, defining
minimum and maximum of the pair to decide about dividend and divisor, and making
appropriate choice of factor, and hence k in case the two integers are found to be identical.
2. With input DDS-10639 through DDS-1000310, each pair differing in value minimally in the
last ten digits, number of divisions ranged from 16 through 24 showing no apparent relation
with DDS yielding very poor correlation coefficient with r = 0.39 (Table 3). However, each
time parameter increased linearly with increase in DDS with very good correlation r = 0.95
to 0.96. Maximum time over the test range of integers was consumed in string formation 0.2
to 917 seconds with per cent time consumed, 62.5 to 95.3% with higher per cent over DDS 1
lac. In contrast, product computation consumed minimum period of time which remained
less than a second up to DDS-500155, and was less than 2.5 seconds at DDS-1000310.
Copying time period has been comparable to that of product computation with observed
range of 0.03 to 0.86 seconds. It was conversion of integer to string formation for copying
the product to text file that exhibited prohibitive time consumption of about 15 minutes or
so at DDS-1000310 while it remained about 1.5 and 3 minutes, respectively, at DDS-300294
and DDS-500155. Up to one hundred thousand DDS, the product computation was
complete in 0.1 sec and total processing time took hardly 10 seconds. Input handling time
period was about 4 per cent of total with DDS-100260 and above while it decreased from
1.0 to 0.25 % each over the range for product computation and copying.
3. With constant DDS-100260 and modifying the pair with appropriate factors over test range
(Table 4) exhibited a similar pattern as revealed in preceding observations. On an average
90% of the time was consumed in string formation, 3 to 4 % each in other three processes
with minimum time of 3.1% in product formation. Number of divisions increased linearly
from 1 through 60 over the factor range of 21 through 296 showing r = 0.99 over factors 2 to
4, and r = 0.88 over factors 4 through 296. As apparent decrease in factor, hence increase in
modifier value k remained associated to decrease in number of divisions, whereas time
periods remained unaffected over the test range. Consequently, product computation with
factors 2, 3, and 4 was found to complete on an average in about 0.13, 0.19 and 0.31
seconds, and it remained almost stable, 0.31 to 0.38 seconds, over factors exceeding 3.
4. The results of computation have not been affected by restricting count of divisions (Table
5). Time periods spent on various stages showed linear relation with increase in DDS over
the test range with r = 0.97 to 0.99 with comparable mean values whether divisions were
10
11. restricted to count 7 as against normal recorded divisions in the range as 56 through 65. As
with other experiments, product computation took minimum time period about 2 to 4% of
total compared to about 82 to 89% consumed in string formation.
5. Comparative evaluation of proposed multiplication scheme with respect to that of
Karatsuba revealed that the procedure computed the product about 3.2 times faster over
the test integer ranges DDS-100260 through DDS-500155. Karat method was found to
compute the product about 2.8 times faster than direct multiplication protocol. Product
computation took 0.1 through 0.83 seconds with new protocol compared to 0.32 through
2.70 seconds with Karat method. String formation with either took comparable time, 3
though 230 seconds, while input handling took relatively more time with new protocol, 0.45
through 10.2 seconds, than with Karat, 0.3 through 5.2 seconds. As already emphasized,
string formation consumed 74 to 81% time with either at DDS-100260, and was 95 to 96%
at higher sized integers. Number of divisions ranged from 21 to 24 with r = β0.33 over the
test integer range.
6. Preliminary data analysis studies have revealed suitability of the proposed technique in
multiplying moderately huge integers covering tens to hundreds thousands of decimal digit
sized integers.
7 Conclusion
The present work provides an application of Euclidean division algorithm that enables to compute
product of any two integers as function of pairs of quotient and remainder obtained step-wise
when the two multipliers are subjected to the EDA. The work, therefore, highlights a novel
application of the EDA with respect to the multiplication. Preliminary studies reveal its
applicability to multiply moderately huge integers. Computation of the product is generally very
fast, while maximum time is consumed by conversion of integer into string for further handling. It
is noteworthy that modern cryptography generally require manipulation of integers that are over
100 decimal digits long 3. For instance RSA-1024 in binary form has digits nearly three times
more than its decimal equivalent DDS-309. Currently, most well-known algorithms for
multiplication of two large integers for use in cryptosystems are those of Karatsuba-Ofman,
Toom-Cook, and those based on fast fourier transform (FFT) including Schonhage-Strassen
algorithm (SSA)[4]. The proposed algorithm based on EDA provides a simplistic approach to
achieve the objective. Besides, the procedure is inherently suited for unequal sized pair of
multipliers, the feature is absent in currently used algorithms wherein there are specific
instructions to employ equal sized integers with digit count in powers of two. The proposed work
is anticipated to have both academic and practical implications in elementary number theory.
3
https://www.brainkart.com/article/Multiplication-of-Large-Integers 8025/
11
12. References
[1] Barik B. Lucas sequence, its properties and generalization. M.Sc. Project Report,
Department of Mathematics, NIT, Rourkela, Odhisha, India, 2013.
[2] Burton DM. Elementary number theory. Tata McGraw-Hill Publishing Company Ltd, New
Delhi, 2007.
[3] Huntley HE. The divine proportion : a study in mathematical beauty. Dover Publications,
Inc., New York, 1970.
[4] Jahani S, Samsudin A, Subramanian KG. Efficient big integer multiplication and squaring
algorithms for cryptographic applications. Journal of Applied Mathematics 2014; Article ID
107109, 9 pages4.
[5] Lipschultz S, Lipson M. Schaumβs outlines of theory and problems of discrete mathematics.
Tata McGraw-Hill Publishing Company Ltd, New Delhi, 2004.
[6] Rivest RL, Shamir A, Adelman L. A method for obtaining digital signatures and public-key
cryptosystems. Communications of ACM 1978; 21 (2): 120-126.
[7] Tattersal JJ. Elementary number theory in nine chapters. Cambridge University Press, New
York, 1999.
Table 1 Euclidean Division Algorithm for multiplying two integers: x > y
Level Dividenda Divisorb Quotient Remainder (d2) β q
i d q r
1 1234 347 3 193 361227
2 347 193 1 154 37249
3 193 154 1 39 23716
4 154 39 3 37 4563
5 39 37 1 2 1369
6 37 2 18 1 72
7 2 1 2 0 2
xy =
P7
i=1 d2
i β qi = 428198
a
First dividend is x and subsequent dividend is preceding divisor
b
First divisor is y and subsequent divisor is preceding remainder
4
http://dx.doi.org/10.1155/2014/107109
12
13. Table 2 Euclidean Division Algorithm for multiplying two integers: x = x
Level Dividenda Divisorb Quotient Remainder (d2) β q
i d q r
1 1534 934 1 600 872356
2 934 600 1 334 360000
3 600 334 1 266 111556
4 334 266 1 68 70756
5 266 68 3 62 13872
6 68 62 1 6 3844
7 62 6 10 2 360
8 6 2 3 0 12
P8
i=1 d2
i β qi = 1432756
a
First dividend is x + k and subsequent dividend is preceding divisor
b
First divisor is x β k and subsequent divisor is preceding remainder
k is an arbitrary integer less than size of multiplier x
Table 3: Processing timesa
and count of divisions over test integer range with EDBMAb
Input integersc Input Product String Copying Divisionsd
handling formation conversion to text file n
DDS-10639 0.07 0.02 0.20 0.03 16
DDS-30094 0.08 0.02 0.88 0.02 22
DDS-100260 0.44 0.10 9.32 0.11 22
DDS-300294 3.69 0.40 82.70 0.43 24
DDS-500155 10.13 0.84 229.34 0.86 21
DDS-1000310 40.25 2.43 916.74 2.48 22
a
Each time parameter is in seconds as mean of three observations.
b
EDBMA, Euclidean division based multiplication algorithm.
c
Smaller member differs from larger member for its last ten digits are replaced with unity each.
d
For n divisions there are 2n multiplications and n β 1 additions.
13
14. Table 4: Processing timesa
and count of divisions as affected by varying factorsb
Choice factor Inputc Product String Copying Divisions
handling formation conversion to text file n
21 0.45 0.14 9.26 0.15 1
3 0.44 0.19 9.35 0.20 3
22 0.45 0.32 9.34 0.34 6
26 0.44 0.31 9.31 0.32 8
212 0.45 0.31 9.35 0.35 11
224 0.44 0.32 9.32 0.33 20
248 0.45 0.33 9.35 0.40 33
296 0.45 0.34 9.31 0.37 60
a
Each time parameter is in seconds as mean of three observations.
b
The count of divisions increases with increase in factor or decrease in k .
c
An identical pair of integer DDS-100260 is modified by appropriate factor.
Table 5: Processing timesa
with restricted count of divisionsb
Input integersc Input Product String Copying Divisions
handling formation conversion to text file n
DS-100260 0.43 0.33 9.31 0.39 60
DS-100260 0.46 0.32 9.35 0.35 7
DS-300294 3.38 1.24 26.50 1.26 56
DS-300294 3.37 1.23 26.50 1.25 7
DS-500155 9.31 2.72 73.45 2.73 64
DS-500155 9.31 2.66 73.38 2.69 7
DS-1000310 37.14 8.01 293.96 8.06 65
DS-1000310 37.16 7.92 295.40 7.93 7
a
Each time parameter is in seconds as mean of three observations.
b
The count of divisions restricted to 7 yielded identical products with each test integer.
c
An identical pair of integers employed with modifying factor 296
.
14