J
OURNAL DE
T
HÉORIE DES
N
OMBRES DE
B
ORDEAUX
W
IEB
B
OSMA
Signed bits and fast exponentiation
Journal de Théorie des Nombres de Bordeaux, tome
13, n
o1 (2001),
p. 27-41
<http://www.numdam.org/item?id=JTNB_2001__13_1_27_0>
© Université Bordeaux 1, 2001, tous droits réservés.
L’accès aux archives de la revue « Journal de Théorie des Nombres de Bordeaux » (http://jtnb.cedram.org/) implique l’accord avec les condi-tions générales d’utilisation (http://www.numdam.org/conditions). Toute uti-lisation commerciale ou impression systématique est constitutive d’une infraction pénale. Toute copie ou impression de ce fichier doit conte-nir la présente mention de copyright.
Article numérisé dans le cadre du programme Numérisation de documents anciens mathématiques
Signed
bits
and
fast
exponentiation
par WIEB BOSMA
RÉSUMÉ. Nous donnons une
analyse précise
dugain
obtenu enutilisant la
représentation
des entiers sous la formenon-adjacente,
plutôt
que lareprésentation binaire, lorsqu’il s’agit
de calculer lespuissances d’éléments dans un groupe dans
lequel l’inversion
est facile. En comptant le nombre demultiplications
pour un ex-posant aléatoire ayant un nombre donné de bits dans son écriturebinaire, nous obtenons une version
précise
du résultatasympto-tique connu, selon
lequel
en moyenne, unparmi
trois bitssignés
de la formenon-adjacente
n’est pas nul. Cela montre que l’utilisationdes bits
signés
réduit le coût del’exponentiation
d’unneuvième,
par rapport à la méthode ordinaire consistant à des élevations au
carré et à des
multiplications répétées.
ABSTRACT. An exact
analysis
isgiven
of the benefits ofusing
the
non-adjacent
form representation for integers(rather
than thebinary
representation),
whencomputing
powers of elements in agroup in which
inverting
is easy.By
counting the number ofmultiplications
for a random exponent requiring agiven
numberof Its in its
binary
representation, we arrive at a precise version of the known asymptotic result that on average one in threesigned
bits in thenon-adjacent
form is non-zero. This shows that the useof
signed
bits(instead
of bits forordinary repeated
squaring andmultiplication)
reduces the cost of exponentiationby
one ninth.1. Introduction
To raise elements of a monoid into the power e >
1,
the method ofrepeated
squaring
andmultiplication
is oftenemployed.
To calculatexe,
where e =
£2=o
bi2i,
with b2 E
10, 11
and bn =1,
the powersare
computed by
repeated squaring,
and xe is foundby taking
theproduct
ofthe yi
forwhich bi
= 1. It is clear thatcomputing xe
thisway takes
l(e) -1
squarings
andw(e) -
1multiplications,
where the(binary)
length
Manuscrit reçu le 22 octobre 1999.
28
l (e) - n
+ 1 and theHamming weight
w(e)
are the total number of bits and the number of non-zero bitsb2
used to express theexponent
e.If the monoid is a group in which inverses can be
computed
efhciently,
it may be
advantageous
to use a differentrepresentation
of theexponent.
Writing
e =si 2i,
where si E
I - 1, 0, I},
we have obtained asigned
bitrepresentation
[2]
for e. To determinexe,
again
compute
via
repeated squaring,
and accumulate theproduct
(for
the non-zero which involves an inversion if s2 = -l.The
advantage
ofsigned
bitrepresentations
is that thesigned
bitweight
ws(e)
may be smaller thanw(e).
Taking
e = 15 forexample,
thebinary
rep-resentation consists of four bits
equal
to 1. But 15 =24 -1,
so asigned
bitrepresentation
ofweight
2 andlength
5 exists. At the cost of one inversion and an extrasquaring
we have done away with twomultiplications.
There exist better ways to
compute
xe, using
arbitrary
addition chains or addition-subtraction chains. Webriefly
discuss them in Section 3.A
complication
inconsidering signed
bits may seem thatsigned
bitrep-resentations of
integers
areby
no meansunique.
Indeed,
using
that theinteger
1 has arepresentation
1 =2k
+~~=o 20131-2~,
forany
>1,
it is seen that everyinteger
admitsinfinitely
manysigned
bitrepresentations.
In Section 2 we describe the
non-adjacent
form,
which selects aunique
signed
bitrepresentation
for anynon-negative integer
e. We indicate howit,
and a modified version ofit,
can be determinedefhciently,
and we showthat these
special representations
have certainoptimal properties.
In Sections 4 and 5 we will
analyze exactly
theweight
ofnon-adjacent
forms forintegers
e. It is shown(in
aprecise
sense)
that on average thisweight
is a third of thelength
of e, asopposed
to a half for thebinary
form. Ingeneral
thegain
that can be achieved from this inexponentiation
willdepend
on the relative costs ofinverting,
multiplying,
andsquaring
in the group. The standard
application
forsigned
bitexponentiation
isto the arithmetic of
elliptic
curves,[7], [9].
The group ofpoints
on anelliptic
curve over a field in Weierstrass form has the desiredproperty
thatinverting
is(almost)
for free. Wheninverting
is free the results of Section5 show that a reduction
by
a ninth incost,
on average, is obtainedby using
thenon-adjacent
form rather than thebinary
form. This makesprecise
a result that so faronly
seems to be knownheuristically
orasymptotically
~1~,
[7], [9]. (Note
that in theelliptic
curve casesquarings
areusually slightly
moreexpensive
thanordinary
multiplications,
which means that the cost reduction fromusing
signed
bits is in factless.)
2.
Signed
BitsTo fix the
notation,
let asigned-bit
representation
of length
l (e)
for aposi-t.. b h h
I(e)-l
si2’,
tive
integer
e be a sequence81(e)-l,
st e -2 - - - ,
so such that e =with si E
I - 1, 0, 11
and = 1. Sometimes we will write m =L(e) -1;
the sequence ofsigned
bits si
isusually
written without comma’s withmost-significant digit
81(e)-i
first. In a sequence ofsigned
bits thesymbol
1
will denote -1. Thus10001
is asigned
bitrepresentation
for 15.As we have seen
already,
e will ingeneral
havesigned-bit
representations
of variouslengths;
indeed,
since we mayreplace
theleading
2mby
2m+1
-2r’’L,
a process which can berepeated,
we findinfinitely
manyrepresentations
for any e, ofarbitrary
(large enough)
length.
With ourapplication
ofminimizing
costs ofexponentiation
inmind,
we areparticularly
interestedin short
representations
of lowweight.
We will call a
signed
bitrepresentation
for eoptirrzal
if it has leastpossible
weight
and among allrepresentations
of minimalweight
it has minimallength clearly
thelength
of thebinary
expansion
is a lower bound for thelength
of asigned-bit
representation.
But note thatoptimality
does not determine aunique representation
ingeneral,
as theexample
11 =23+2+1
= 2~ + 2~ -
1 shows.Let us first worry about
uniqueness.
Thenon-adjacent
form
representa-tion is the
signed
bitrepresentation
for e characterizedby
theproperty:
Proposition
1. Positiveintegers
haveunique
non-adjacent form
represen-tations.
Proof. Suppose
that there existpositive integers
e with two differentnon-adjacent
forms.Among
all such e select eohaving
anon-adjacent
form of minimallength.
Theminimality
conditionrequires
that the leastsignificant
bit in the minimalrepresentation
of eo differs from that in any other. Theonly
admissiblepairs
for the twoleast-significant
bits innon-adjacent
forms are00, 01, 01, 10,
TO;
only
10
and 10 determine the same value modulo4,
but theirleast-significant
bits areequal.
This ends the
proof.
DIt is easy to obtain the
non-adjacent
form from theordinary binary
ex-pansion : apply
thefollowing
rulerepeatedly, working
fromright
to left(least-significant
first):
replace
any sequence 01 ... 1by
10 ... 01where the number of consecutive 0’s in the latter is one less than the number of consecutive 1’s in the former.
30
Since
Ek =
2k+1 - 1,
it is clear that the result willalways
be anon-adjacent
formrepresentation
for thegiven integer
determinedby
thebinary
expansion.
It will also be clear that thelength
of thenon-adjacent
form iseither
equal
to or onelarger
than that of thebinary
expansion.
Example. Starting
with thebinary
expansion
for 3190 =211
+210
+2 6+
25
+24
+22
+2,
the ruleproduces:
for 3190 =
2 12 -210+2 7-2 3 -2.
In fact the above
procedure
can begeneralized
to transform anygiven
signed
bitrepresentation
into thenon-adjacent form;
firstapply
thefollow-ing
rulerepeatedly working
from left toright:
and then
apply
thefollowing repeatedly
(working
fromright
toleft):
followed
by
astep
of the form(I)
if necessary.Proposition
2. For anyinteger
thenon-adjacent form
has minimalweight.
Proof.
Apply
the above two rule-transformation to anysigned
bit repre-sentation of minimalweight;
the result is thenon-adjacent
form. Thetransformation does not increase the
weight.
DCorollary
3. For everyinteger
there is aunique
signed
bitrepresentation
satisfying:
moreover this
expansion
isoptimal.
Proof.
Let tito be thenon-adjacent
form for e. If the three mostsignificant
bits are101,
then let n = m - 1 and defineIn all other cases let n = m
and si
= ti for 0i
n. This way s isequal
to thenon-adjacent
formexcept
when theleading digits
for thenon-adjacent
form are
1010,
in which case wereplace
themby
the shorterexpansion
withleading digits
110.Clearly s
satisfies thenon-adjacency
conditions of thestatement; we will show that it is
optimal
too.In the
exceptional
case theweights
of s and t areequal,
but thelength
of sequals
that of thebinary
expansion.
Hence s isoptimal
in that case. We will prove that in all other cases thenon-adjacent
form t itself isoptimal.
Suppose
that e is aninteger
withnon-adjacent
formtlto
of minimallength
that is notoptimal.
Since thenon-adjacent weight
isalways
minimal,
this canonly
occur if thelength
of thenon-adjacent
form of e exceeds that of itsbinary
expansion
by
1. Thisonly
happens
if in the final transformationstep
a sequence 2adjacent
l ’s isreplaced by
io ... 01-,
where the number of 0’s 1. If k = 2 we are in theexceptional
case,
so we will assume that 1~ > 2. The
binary
expansion
uo has=
um-2 = =
1,
while = 0 or 1.Since the
non-adjacent weight
isminimal,
there must exist asigned
bitrepresentation
VO oflength
m, and itnecessarily
has = =Vm-3 =
1,
and Vm-4 = Um-4 Ef 0, 11
since u and v represent the same number e. If =1,
an extra reductionstep
reduceslength
plus
weight,
which contradictsoptimality
of v. So =0;
but then u contradictsminimality
of m sincerepresents
the same number as with lowerweight.
That ends the
proof.
DWe will refer to the
optimal
representation
ofCorollary
3 as themodified
non-adjacent form.
It is the same as thenon-adjacent
form,
except
thatnon-adjacency
is allowed in the mostsignificant
twobits,
that is 110 isnot transformed to
1010,
because such transformation increases thelength
withoutdecreasing
theweight.
Note that this does not mean that the modified version is different for
precisely
thoseintegers
for which theleading
bits in thebinary
expansion
are 110 because of thepropagation
of carries in the transformations:non-adjacent
and modifiednon-adjacent
forms for 27 = 11011 =100101
are thesame, but for 25 = 11001
they
aredifferent,
namely
101001 and 11001. It is not so difficult to obtain the(modified)
non-adjacent
formdirectly
from e, withoutcomputing
thebinary
(or
anothersigned-bit)
expansion
first. The method resembles the method forfinding
thebinary
expansion
producing
the leastsignificant
bit first:starting
with k = erepeat:
if k even:
produce
0 and divideby
2;
if k odd:
produce
1,
subtract 1 from k and divide 1~by
2;
until k is 0.For the
non-adjacent
form oneproceeds
as follows.Starting
with = e > 01~ mod
4=s~{2013l,l}~
produce signed
bits s and0,
andreplace k by
(k -
s)/4;
I~ mod 4 - s E
~0, 2~:
produce
0 andreplace
by
1~/2.
until is less than orequal
to3,
after whichif k = 0:
produce nothing;
produce
1;
if k = 2:
produce
0 and1;
if k = 3:produce
1
and 0 and1;
and terminate.For the modified version the
only change
necessary is toproduce
11 in the case that I~ = 3.Note the similarities with the continued fraction
algorithm,
where divi-sionby
2 isreplaced by inverting,
and truncationreplaces
extracting
bits. Thealgorithm
to obtain thenon-adjacent
form is similar to the nearestinteger
continued fractionalgorithm.
The table shows
binary
expansion,
non-adjacent
form,
and modifiednon-adjacent
form for the first fewpositive integers.
3. Addition-subtraction chains
The method of
repeated squaring
andmultiplication
does notnecessarily
give
the fastest way to evaluate powers. It is well-known[6]
that there areways to find xe
using
fewermultiplications.
An addition chain for a
positive integer
e is a sequence 1 =eo, el, ... ,
ek = e with the
property
that for 1 i 1~ it holds that ei =eu + ev with 0 u, v i. Each term is thus the sum of two
(possibly
thesame)
previous
terms. Oneusually
arranges the ei inascending
order. Thelength
of theaddition chain is the
integer
1~. It will be clear that an addition chain for e can be used tocompute
xe : for any i the power xei can becomputed
fromxe~ , ... ,
by
asingle
multiplication.
Thebinary
expansion
e =En 0
b222 of
any e of length
n + 1 defines an addition chain oflength
n +w(e) -
1 for e,corresponding
torepeated
squaring
andmultiplication
as described in Section1,
as follows. Write down the powers pi =2’, i
=0, ... ,
n of 2 less than orequal
to e. Next take ro = 0 and let rj berj-I +Pij’
wherei1, ... , ik
are those i from 0 to n forwhich bi
#
0. The addition chain for e then consists of the the pi(with
1 i C
n)
and r j(with j > 1)
inascending
order.There is an alternative addition chain associated with the
binary
expan-sion,
obtainedby reading
the bits from left toright
(most
significant
first) .
Starting
with eo = 1 onerepeats
for i =1, ... ,
n: ifbn-i
= 1:append
2ej
and2ei
+ 1 to theexisting
sequence eo, ... e~ ; otherwise:append
2ej
to theexisting
sequence eo, ...34
There are two
problems
withgeneral
addition chains. In the firstplace
is it hard to find a shortest chain for
given
e[6].
Secondly, general
addition chains make it necessary to remember entriesxe°, ... ,
xez-1along
the way tocompute
xi .
Note that this is not true for theleft-to-right binary
additionchain,
as ei is either2e2_1
orei-1 + 1,
thatis,
everystep
is either asquaring
or amultiplication by x
([4],
see also[8]
for thespecial
case ofinteger
exponentiation) .
Taking
thepossibility
ofsubtracting
into account aswell,
we arrive at addition-subtraction chains[11].
Ingeneral
we cannot insist onascending
entries anymore.Again,
it will be clear that anysigned-bit
representation
of e willgive
rise to two addition-subtractionchains, by reading
thesigned
bits either way. It is also obviousthat,
since theweight
of asigned
bitrepresentation
can be smaller than that of thebinary
expansion,
that thecorresponding
chain may be shorter.Examples.
Let e =43;
reading
its bits 101011right-to-left
to obtain thesequence of
p2’s l, 2, 4, 8,16, 32
and ofrj’s
3,11, 43,
we obtain an addition chainby
merging
andordering:
1, 2, 3, 4, 8,11,16, 32, 43
oflength
8.Reading
thebinary
expansion
101011left-to-right produces
eo =1,
thenei =
2,
and e2 =4,
e3 =
5,
then e4 =10,
and e5 =20,
e6 =21,
andfinally
e7 =
42,
e8 = 43.
Indeed,
length
8 for 5doublings
and 3multiplications.
Reading
the modifiednon-adjacent
form 43 =110101
left-to-right
gives
the addition-subtraction chain
1, 2, 3, 6,12,11, 22, 44, 43,
reading
itright-to-left the chain
-1, 2,
4, -5, 8, 16, 11, 32,
43. Both havelength
8. Thenon-adjacent
formgives
chains oflength
9.There exists an addition chain of
length
7 for 43:1, 2, 4, 8, 9,17, 34, 43.
The addition-subtraction chain1, 2, 4, 8,16,15
associated with 15 =24
-20,
is shorter than the chain1, 2, 3, 6, 7, 14, 15 arising
from thebinary
ex-pansion ~ 15
=23
+2 2
+21
+20.
In this case there is an addition chain oflength
5 aswell,
however:1, 2, 3, 5, 10, 15
forexample.
In
general,
for e =2~ 2013
1 thebinary
expansion gives
rise to an addition chain oflength
2k - 2 while thenon-adjacent
form leads to an addition-subtraction chain oflength k
+ 1.Outside numbers of this
form,
e = 23 is the firstexample
where the modifiednon-adjacent
form for e leads to an addition-subtraction chain(1,
2, 3, 6,12, 24,
23 oflength
6)
that isstrictly
shorter than thebinary
ad-dition chains(l, 2, 4, 5,10,11, 22, 23
andl, 2, 3, 4, 7, 8,16,
23 oflength
7).
Again
there exist addition chains oflength
6,
like1, 2, 3, 5,10,13, 23.
For e = 27 there are addition chains(such
as1, 2, 3, 6,
9,18, 27)
that are shorter than both the chains obtained from thebinary
expansion
(1, 2, 3, 6,
12,13, 26, 27)
and the addition-subtraction chaingotten
from the(modi-fied)
non-adjacent
form(1,
2, 4, 8, 7, 14, 28,
27).
For e = 47 thelength
of the chaingiven
by
the modifiednon-adjacent
form(1,
2, 3, 6, 12, 24,
length
8:1, 2, 3, 4, 7,10, 20, 27, 47
forexample,
while thebinary gives
length
9:
1,2,4,5,10,11,22,23,46,47);
in this case there is no shorter addition-subtraction chain either.There are methods to construct short addition chains - these
are not
necessarily
shortest,
but shorter than those obtained from thebinary
ex-pansion.
The results from thepresent
paper indicate thegain
that can be obtainedby
using
signed
bits rather thanbits;
perhaps
this will lead to a moregeneral
analysis
of theadvantages
of addition-subtraction chains over addition chains(in
situations wherethey
areapplicable).
4.
Analysis
To
analyze
the benefits ofusing
thesigned
bitrepresentations,
we firstprove some results on
(average)
length
ofnon-adjacent
and modifiednon-adjacent
forms. Let denote the number ofpositive integers requiring
exactly
n bits in theirbinary
representation,
and letcn
andc~
be the number ofpositive integers requiring
exactly
nsigned
bits in thenon-adjacent
form and in the modifiednon-adjacent
formrepresentation,
respectively.
Also,
letCn,
Cn
andCn
similarly
define the number ofpositive integers requiring
at most n bits in the threerepresentations.
Proposition
4. The numberof
positive integers
withexpansions
of
length
n isgiven by
ci =c’
=c" =
1,
andfor
n > 2:Hence,
for
n> 0:Proof. Only
1requires
one bit in anyexpansion.
It is also clear that there areexactly
2n-1 integers
with mostsignificant
bit 1(of
length
n),
so
2n-1
andCn =
2n .The easiest way to count
integers
with nsigned
bits in theirnon-adjacent
form is to observe that thefollowing
recursion holds:Namely,
thec~
positive integers
oflength n
(all
having
- 1 ) ,
when’prepended’
with sn =
0 and 1 all contribute. Weget
another contribution of sizecn
by
flipping
the n-th bit to -1. This accounts for allpositive integers
requiring
n + 2 bits for which 0. We obtain those withbn-1
= 0by taking
thecn+l
representations
oflength n
+ 1 andreplacing
theleading digit
bn =
1by
bn =
0 andputting
1. Thisway the
validity
of the recursion can be seen to hold. Withstarting
values36
then
easily proved,
forexample by
induction. The formula forC£
issimply
obtained
by
summation:One way to count
integers
with modifiednon-adjacent
form oflength n
is to use that their number also satisfies the recursion:
This time one takes the
representations
oflength
n, and obtains from eachtwo valid
representations
oflength n
+ 2by shifting
over 2places
andinserting bl -
0 and From thelength n
+ 1representations
one
gets
length n
+ 2representations
by shifting
oneplace
andtaking
bo -
0. Thisclearly
leads to2cn
+ validrepresentations
oflength
n + 2
(taking
care that n > 1 toprevent
theillegal
representation 101
for3)
that are all distinct(look
atbo);
it is notterribly
hard to see that we obtain all valid modifiedsigned
bitrepresentations
this way. Thestarting
values for the recursion arec"
= 2 andc3
= 3.Again,
Cn
can be derivedby
summation. DHere are the first few values for each of the functions:
Remarks. Note that c, also satisfies the recursion that
cn
andcn
satisfy.
The sequence
cn
has been called the Jacobsthal sequence(A001045
in[10];
see also
[5]).
Next we count the total
weight
of allrepresentations
of fixedlength.
Definesn to be the total number of ones in all different n-bit
integers;
we usesn
andsn
for the total number of non-zerosigned
bits in all differentnon-adjacent
forms and modifiednon-adjacent
forms oflength
n.Similarly, by
,S’n,
Sn
and we denote the total number of non-zeroes in in allbinary,
non-adjacent
and modifiednon-adjacent
representations
oflength
at mostn.
Also,
_ ... _ -.
Proof.
To count the total number of non-zero bits in n-bitwords,
note that n + 1 bit words can be formed out of n-bit wordsby shifting
and’appending’
asingle
bit(0
or1).
Since there are cn such n-bitintegers,
having sn
non-zerobits,
we findFrom and 82 = 3 we
get
the resultby
induction.To prove the formula for note that
This follows
immediately
from theproof
of theprevious
Proposition.
Then use verificationof s1 = s2
= 1 and induction.For s"
one derivessimilarly
thatFor
Sun
and~5’n
we sumonly
using
thatHere are the first few values for each of the functions
again:
As a consequence we can determine how many non-zero
(signed)
bits there are on average in allintegers requiring
exactly
or at most n bits in38
Corollary
6. For all n > 2:and
This
Corollary,
theproof
of which is an easycomputation,
tells us that onaverage half the bits in a
binary
expansion
are non-zero(as expected),
onein three
signed
bits in thenon-adjacent
form are non-zero(compare
[1,
3,
9]).
For the modifiednon-adjacent
form also a third of the bits are non-zeroasymptotically,
but the convergence isslightly
slower because there are fewer zeroes in theexceptional
case.To
give
a faircomparison,
we need to count the number of bits used forinteger
withbinary
expansion
oflength
n. An n-bitinteger
is anon-negative integer
for which theordinary binary
representation
haslength
nexactly.
5.
Analysis
forintegers
ofgiven length
First we count the total
length
and the totalweight
of n-bitintegers
inthe various
representations.
As usual we denoteby
l,
l’, l"
andL,
L’,
L" the values forordinary binary, non-adjacent
form and modifiednon-adjacent
formrepresentation.
Proposition
7. The totallength of
all numbers that takeexactly
n bits inThe total
length of
all numbers that take at most n bits(in
theordinary
representation):
Proof. Obviously
the cnlength n integers
give
One way to
count Ln
is to determine whichlength
nintegers
contribute tolength
nnon-adjacent
forms. These are thebinary
expansions
oflength
n for whichbn-2
= 0 and for which thenon-adjacent
form ofbn-3bn-4 ... bo
haslength
n - 2. Of those there areexactly
Cn_2.
Theothers,
cn -Cn-2
=Cn-2
=Cn_1-1
in number(compare
(*)),
contributelength
n + 1each,
soUsing Proposition
4immediately
gives
the desired result.Similarly
it can be proven thatFor
Ln
wemerely
sum:and likewise for
L’
andL~.
The first few values for these functions are:
Let wn,
w’, w"
denote the totalweight
of allnon-negative
integers
requir-ing
exactly
n bits inbinary
representation,
andWn,
Wn, Wn
the same for40
Proposition
8.Proof. Obviously again,
The
weight
ofnon-adjacent
and modifiednon-adjacent
forms are the same, sown - wn
andWn
=W#.
The firstinteger
thatrequires n
binary
bits isfn _
2n-1.
For everyinteger h larger than fn
for which thelength
ofits
non-adjacent
form is n, there is aninteger g
smaller thanfn
that hasnon-adjacent
form oflength n -1
and the sameweight
as h:simply
reverse all bits of hexcept
for the mostsignificant
one. Thus theintegers
withnon-adjacent
forms oflength n
other thanf n
(which
hasweight
1)
contributeexactly
half their totalweight,
that is(sn - 1)/2,
town.
On the otherhand,
for the same reasonexactly
half the totalweight
of thelength
non-adjacent
forms contribute to thebinary length n
count,
whichimplies
thatthe +1
being
the contribution offn
itself. Substitution thengives
theresult. 0
A small table
again:
Corollary
9. The numberof multiplications
necessary tocompute
xefor
a randominteger
eof exactly
n bitsusing
thebinary
expansion,
theIf
e is randorraof
at most ndigits,
the costfunctions
are:As
expected
we seethat,
for e ofbinary length
n, it takes n -1multipli-cations
(all squarings)
and on average(n -1)/2
multiplications using
thebinary
expansion
for e;using
thenon-adjacent
form the number ofmul-tiplications
can be reduced to(n -1)/3,
where on average we save1/3
multiplication
using
the modified form. References[1] S. ARNO, F. S. WHEELER, Signed digit representations of minimal Hamming weight. IEEE Transactions on Computers 42 (1993), 1007-1010.
[2] A. D. BOOTH, A signed binary multiplication technique. Quart. Journ. Mech. and Applied Math. 4 (1951), 236-240.
[3] D. M. GORDON, A survey of fast exponentiation methods. Journal of Algorithms 27 (1998), 129-146.
[4] R. L. GRAHAM, A. C.-C. YAO, F.-F. YAO, Addition chains with multiplicative cost. Discrete Math. 23 (1978), 115-119.
[5] A. F. HORADAM, Jacobsthal representation numbers. Fibonacci Quart. 34 (1996), 40-54. [6] D. E. KNUTH, The Art of Computer Programming 2: Seminumerical Algorithms (third
edition), Reading: Addison Wesley, 1998.
[7] NEAL KOBLITZ, CM-curves with good cryptographic properties, in: Feigenbaum (ed),
Ad-vances in Cryptology 2014
Proceedings of Crypto ’91, Lecture Notes in Computer Science 576,
(1991), 279-296.
[8] D. P. McCARTHY, Effect of improved multiplication efficiency on exponentiation algorithms
derived from addition chains. Math. Comp. 46 (1976), 603-608.
[9] F. MORAIN, J. OLIVOS, Speeding up the computations on an elliptic curve using
addition-subtraction chains. RAIRO Inform. Theory 24 (1990), 531-543.
[10] N. J. A. SLOANE, S. PLOUFFE, The encyclopedia of integer sequences. San Diego: Academic
Press, 1995. http://www.research.att.com/ njas/sequences/
[11] HUGO VOLGER, Some results on addition/subtraction chains. Information Processing Letters
20 (1985), 155-160.
Wieb BOSMA Vakgroep Wiskunde
Universiteit van Nijmegen
The Netherlands