home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pytexdoc / ext / lib / lib2 / mpz / tex
LaTeX Document  |  1996-11-08  |  3.2 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |n Module| \sectco|
|00000020| 64 65 7b 6d 70 7a 7d 7d | 0a 5c 62 69 6d 6f 64 69 |de{mpz}}|.\bimodi|
|00000030| 6e 64 65 78 7b 6d 70 7a | 7d 0a 0a 54 68 69 73 20 |ndex{mpz|}..This |
|00000040| 69 73 20 61 6e 20 6f 70 | 74 69 6f 6e 61 6c 20 6d |is an op|tional m|
|00000050| 6f 64 75 6c 65 2e 20 20 | 49 74 20 69 73 20 6f 6e |odule. |It is on|
|00000060| 6c 79 20 61 76 61 69 6c | 61 62 6c 65 20 77 68 65 |ly avail|able whe|
|00000070| 6e 20 50 79 74 68 6f 6e | 20 69 73 0a 63 6f 6e 66 |n Python| is.conf|
|00000080| 69 67 75 72 65 64 20 74 | 6f 20 69 6e 63 6c 75 64 |igured t|o includ|
|00000090| 65 20 69 74 2c 20 77 68 | 69 63 68 20 72 65 71 75 |e it, wh|ich requ|
|000000a0| 69 72 65 73 20 74 68 61 | 74 20 74 68 65 20 47 4e |ires tha|t the GN|
|000000b0| 55 20 4d 50 20 73 6f 66 | 74 77 61 72 65 20 69 73 |U MP sof|tware is|
|000000c0| 0a 69 6e 73 74 61 6c 6c | 65 64 2e 0a 0a 54 68 69 |.install|ed...Thi|
|000000d0| 73 20 6d 6f 64 75 6c 65 | 20 69 6d 70 6c 65 6d 65 |s module| impleme|
|000000e0| 6e 74 73 20 74 68 65 20 | 69 6e 74 65 72 66 61 63 |nts the |interfac|
|000000f0| 65 20 74 6f 20 70 61 72 | 74 20 6f 66 20 74 68 65 |e to par|t of the|
|00000100| 20 47 4e 55 20 4d 50 20 | 6c 69 62 72 61 72 79 2c | GNU MP |library,|
|00000110| 0a 77 68 69 63 68 20 64 | 65 66 69 6e 65 73 20 61 |.which d|efines a|
|00000120| 72 62 69 74 72 61 72 79 | 20 70 72 65 63 69 73 69 |rbitrary| precisi|
|00000130| 6f 6e 20 69 6e 74 65 67 | 65 72 20 61 6e 64 20 72 |on integ|er and r|
|00000140| 61 74 69 6f 6e 61 6c 20 | 6e 75 6d 62 65 72 0a 61 |ational |number.a|
|00000150| 72 69 74 68 6d 65 74 69 | 63 20 72 6f 75 74 69 6e |rithmeti|c routin|
|00000160| 65 73 2e 20 20 4f 6e 6c | 79 20 74 68 65 20 69 6e |es. Onl|y the in|
|00000170| 74 65 72 66 61 63 65 73 | 20 74 6f 20 74 68 65 20 |terfaces| to the |
|00000180| 5c 65 6d 70 68 7b 69 6e | 74 65 67 65 72 7d 0a 28 |\emph{in|teger}.(|
|00000190| 5c 73 61 6d 70 7b 6d 70 | 7a 5f 7b 5c 72 6d 20 5c |\samp{mp|z_{\rm \|
|000001a0| 6c 64 6f 74 73 7d 7d 29 | 20 72 6f 75 74 69 6e 65 |ldots}})| routine|
|000001b0| 73 20 61 72 65 20 70 72 | 6f 76 69 64 65 64 2e 20 |s are pr|ovided. |
|000001c0| 49 66 20 6e 6f 74 20 73 | 74 61 74 65 64 0a 6f 74 |If not s|tated.ot|
|000001d0| 68 65 72 77 69 73 65 2c | 20 74 68 65 20 64 65 73 |herwise,| the des|
|000001e0| 63 72 69 70 74 69 6f 6e | 20 69 6e 20 74 68 65 20 |cription| in the |
|000001f0| 47 4e 55 20 4d 50 20 64 | 6f 63 75 6d 65 6e 74 61 |GNU MP d|ocumenta|
|00000200| 74 69 6f 6e 20 63 61 6e | 20 62 65 20 61 70 70 6c |tion can| be appl|
|00000210| 69 65 64 2e 0a 0a 49 6e | 20 67 65 6e 65 72 61 6c |ied...In| general|
|00000220| 2c 20 5c 64 66 6e 7b 6d | 70 7a 7d 2d 6e 75 6d 62 |, \dfn{m|pz}-numb|
|00000230| 65 72 73 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |ers can |be used |
|00000240| 6a 75 73 74 20 6c 69 6b | 65 20 6f 74 68 65 72 20 |just lik|e other |
|00000250| 73 74 61 6e 64 61 72 64 | 0a 50 79 74 68 6f 6e 20 |standard|.Python |
|00000260| 6e 75 6d 62 65 72 73 2c | 20 65 2e 67 2e 5c 20 79 |numbers,| e.g.\ y|
|00000270| 6f 75 20 63 61 6e 20 75 | 73 65 20 74 68 65 20 62 |ou can u|se the b|
|00000280| 75 69 6c 74 2d 69 6e 20 | 6f 70 65 72 61 74 6f 72 |uilt-in |operator|
|00000290| 73 20 6c 69 6b 65 20 5c | 63 6f 64 65 7b 2b 7d 2c |s like \|code{+},|
|000002a0| 0a 5c 63 6f 64 65 7b 2a | 7d 2c 20 65 74 63 2e 2c |.\code{*|}, etc.,|
|000002b0| 20 61 73 20 77 65 6c 6c | 20 61 73 20 74 68 65 20 | as well| as the |
|000002c0| 73 74 61 6e 64 61 72 64 | 20 62 75 69 6c 74 2d 69 |standard| built-i|
|000002d0| 6e 20 66 75 6e 63 74 69 | 6f 6e 73 20 6c 69 6b 65 |n functi|ons like|
|000002e0| 0a 5c 63 6f 64 65 7b 61 | 62 73 7d 2c 20 5c 63 6f |.\code{a|bs}, \co|
|000002f0| 64 65 7b 69 6e 74 7d 2c | 20 5c 6c 64 6f 74 73 2c |de{int},| \ldots,|
|00000300| 20 5c 63 6f 64 65 7b 64 | 69 76 6d 6f 64 7d 2c 20 | \code{d|ivmod}, |
|00000310| 5c 63 6f 64 65 7b 70 6f | 77 7d 2e 0a 5c 73 74 72 |\code{po|w}..\str|
|00000320| 6f 6e 67 7b 50 6c 65 61 | 73 65 20 6e 6f 74 65 3a |ong{Plea|se note:|
|00000330| 7d 20 74 68 65 20 7b 5c | 69 74 20 62 69 74 77 69 |} the {\|it bitwi|
|00000340| 73 65 2d 78 6f 72 7d 20 | 6f 70 65 72 61 74 69 6f |se-xor} |operatio|
|00000350| 6e 20 68 61 73 20 62 65 | 65 6e 20 69 6d 70 6c 65 |n has be|en imple|
|00000360| 6d 65 6e 74 65 64 20 61 | 73 0a 61 20 62 75 6e 63 |mented a|s.a bunc|
|00000370| 68 20 6f 66 20 7b 5c 69 | 74 20 61 6e 64 7d 73 2c |h of {\i|t and}s,|
|00000380| 20 7b 5c 69 74 20 69 6e | 76 65 72 74 7d 73 20 61 | {\it in|vert}s a|
|00000390| 6e 64 20 7b 5c 69 74 20 | 6f 72 7d 73 2c 20 62 65 |nd {\it |or}s, be|
|000003a0| 63 61 75 73 65 20 74 68 | 65 20 6c 69 62 72 61 72 |cause th|e librar|
|000003b0| 79 0a 6c 61 63 6b 73 20 | 61 6e 20 5c 63 6f 64 65 |y.lacks |an \code|
|000003c0| 7b 6d 70 7a 5f 78 6f 72 | 7d 20 66 75 6e 63 74 69 |{mpz_xor|} functi|
|000003d0| 6f 6e 2c 20 61 6e 64 20 | 49 20 64 69 64 6e 27 74 |on, and |I didn't|
|000003e0| 20 6e 65 65 64 20 6f 6e | 65 2e 0a 0a 59 6f 75 20 | need on|e...You |
|000003f0| 63 72 65 61 74 65 20 61 | 6e 20 6d 70 7a 2d 6e 75 |create a|n mpz-nu|
|00000400| 6d 62 65 72 20 62 79 20 | 63 61 6c 6c 69 6e 67 20 |mber by |calling |
|00000410| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 63 61 6c |the func|tion cal|
|00000420| 6c 65 64 20 5c 63 6f 64 | 65 7b 6d 70 7a 7d 20 28 |led \cod|e{mpz} (|
|00000430| 73 65 65 0a 62 65 6c 6f | 77 20 66 6f 72 20 61 6e |see.belo|w for an|
|00000440| 20 65 78 61 63 74 20 64 | 65 73 63 72 69 70 74 69 | exact d|escripti|
|00000450| 6f 6e 29 2e 20 41 6e 20 | 6d 70 7a 2d 6e 75 6d 62 |on). An |mpz-numb|
|00000460| 65 72 20 69 73 20 70 72 | 69 6e 74 65 64 20 6c 69 |er is pr|inted li|
|00000470| 6b 65 20 74 68 69 73 3a | 0a 5c 63 6f 64 65 7b 6d |ke this:|.\code{m|
|00000480| 70 7a 28 5c 76 61 72 7b | 76 61 6c 75 65 7d 29 7d |pz(\var{|value})}|
|00000490| 2e 0a 0a 5c 72 65 6e 65 | 77 63 6f 6d 6d 61 6e 64 |...\rene|wcommand|
|000004a0| 7b 5c 69 6e 64 65 78 73 | 75 62 69 74 65 6d 7d 7b |{\indexs|ubitem}{|
|000004b0| 28 69 6e 20 6d 6f 64 75 | 6c 65 20 6d 70 7a 29 7d |(in modu|le mpz)}|
|000004c0| 0a 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|000004d0| 7d 7b 6d 70 7a 7d 7b 76 | 61 6c 75 65 7d 0a 20 20 |}{mpz}{v|alue}. |
|000004e0| 43 72 65 61 74 65 20 61 | 20 6e 65 77 20 6d 70 7a |Create a| new mpz|
|000004f0| 2d 6e 75 6d 62 65 72 2e | 20 5c 76 61 72 7b 76 61 |-number.| \var{va|
|00000500| 6c 75 65 7d 20 63 61 6e | 20 62 65 20 61 6e 20 69 |lue} can| be an i|
|00000510| 6e 74 65 67 65 72 2c 20 | 61 20 6c 6f 6e 67 2c 0a |nteger, |a long,.|
|00000520| 20 20 61 6e 6f 74 68 65 | 72 20 6d 70 7a 2d 6e 75 | anothe|r mpz-nu|
|00000530| 6d 62 65 72 2c 20 6f 72 | 20 65 76 65 6e 20 61 20 |mber, or| even a |
|00000540| 73 74 72 69 6e 67 2e 20 | 49 66 20 69 74 20 69 73 |string. |If it is|
|00000550| 20 61 20 73 74 72 69 6e | 67 2c 20 69 74 20 69 73 | a strin|g, it is|
|00000560| 0a 20 20 69 6e 74 65 72 | 70 72 65 74 65 64 20 61 |. inter|preted a|
|00000570| 73 20 61 6e 20 61 72 72 | 61 79 20 6f 66 20 72 61 |s an arr|ay of ra|
|00000580| 64 69 78 2d 32 35 36 20 | 64 69 67 69 74 73 2c 20 |dix-256 |digits, |
|00000590| 6c 65 61 73 74 20 73 69 | 67 6e 69 66 69 63 61 6e |least si|gnifican|
|000005a0| 74 20 64 69 67 69 74 0a | 20 20 66 69 72 73 74 2c |t digit.| first,|
|000005b0| 20 72 65 73 75 6c 74 69 | 6e 67 20 69 6e 20 61 20 | resulti|ng in a |
|000005c0| 70 6f 73 69 74 69 76 65 | 20 6e 75 6d 62 65 72 2e |positive| number.|
|000005d0| 20 53 65 65 20 61 6c 73 | 6f 20 74 68 65 20 5c 63 | See als|o the \c|
|000005e0| 6f 64 65 7b 62 69 6e 61 | 72 79 7d 0a 20 20 6d 65 |ode{bina|ry}. me|
|000005f0| 74 68 6f 64 2c 20 64 65 | 73 63 72 69 62 65 64 20 |thod, de|scribed |
|00000600| 62 65 6c 6f 77 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |below..\|end{func|
|00000610| 64 65 73 63 7d 0a 0a 41 | 20 6e 75 6d 62 65 72 20 |desc}..A| number |
|00000620| 6f 66 20 7b 5c 65 6d 20 | 65 78 74 72 61 7d 20 66 |of {\em |extra} f|
|00000630| 75 6e 63 74 69 6f 6e 73 | 20 61 72 65 20 64 65 66 |unctions| are def|
|00000640| 69 6e 65 64 20 69 6e 20 | 74 68 69 73 20 6d 6f 64 |ined in |this mod|
|00000650| 75 6c 65 2e 20 4e 6f 6e | 0a 6d 70 7a 2d 61 72 67 |ule. Non|.mpz-arg|
|00000660| 75 6d 65 6e 74 73 20 61 | 72 65 20 63 6f 6e 76 65 |uments a|re conve|
|00000670| 72 74 65 64 20 74 6f 20 | 6d 70 7a 2d 76 61 6c 75 |rted to |mpz-valu|
|00000680| 65 73 20 66 69 72 73 74 | 2c 20 61 6e 64 20 74 68 |es first|, and th|
|00000690| 65 20 66 75 6e 63 74 69 | 6f 6e 73 0a 72 65 74 75 |e functi|ons.retu|
|000006a0| 72 6e 20 6d 70 7a 2d 6e | 75 6d 62 65 72 73 2e 0a |rn mpz-n|umbers..|
|000006b0| 0a 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|000006c0| 7d 7b 70 6f 77 6d 7d 7b | 62 61 73 65 5c 2c 20 65 |}{powm}{|base\, e|
|000006d0| 78 70 6f 6e 65 6e 74 5c | 2c 20 6d 6f 64 75 6c 75 |xponent\|, modulu|
|000006e0| 73 7d 0a 20 20 52 65 74 | 75 72 6e 20 5c 63 6f 64 |s}. Ret|urn \cod|
|000006f0| 65 7b 70 6f 77 28 5c 76 | 61 72 7b 62 61 73 65 7d |e{pow(\v|ar{base}|
|00000700| 2c 20 5c 76 61 72 7b 65 | 78 70 6f 6e 65 6e 74 7d |, \var{e|xponent}|
|00000710| 29 20 5c 25 7b 7d 20 5c | 76 61 72 7b 6d 6f 64 75 |) \%{} \|var{modu|
|00000720| 6c 75 73 7d 7d 2e 20 49 | 66 0a 20 20 5c 63 6f 64 |lus}}. I|f. \cod|
|00000730| 65 7b 5c 76 61 72 7b 65 | 78 70 6f 6e 65 6e 74 7d |e{\var{e|xponent}|
|00000740| 20 3d 3d 20 30 7d 2c 20 | 72 65 74 75 72 6e 20 5c | == 0}, |return \|
|00000750| 63 6f 64 65 7b 6d 70 7a | 28 31 29 7d 2e 20 49 6e |code{mpz|(1)}. In|
|00000760| 20 63 6f 6e 74 72 61 73 | 74 20 74 6f 20 74 68 65 | contras|t to the|
|00000770| 0a 20 20 5c 43 2d 6c 69 | 62 72 61 72 79 20 66 75 |. \C-li|brary fu|
|00000780| 6e 63 74 69 6f 6e 2c 20 | 74 68 69 73 20 76 65 72 |nction, |this ver|
|00000790| 73 69 6f 6e 20 63 61 6e | 20 68 61 6e 64 6c 65 20 |sion can| handle |
|000007a0| 6e 65 67 61 74 69 76 65 | 20 65 78 70 6f 6e 65 6e |negative| exponen|
|000007b0| 74 73 2e 0a 5c 65 6e 64 | 7b 66 75 6e 63 64 65 73 |ts..\end|{funcdes|
|000007c0| 63 7d 0a 0a 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |c}..\beg|in{funcd|
|000007d0| 65 73 63 7d 7b 67 63 64 | 7d 7b 6f 70 31 5c 2c 20 |esc}{gcd|}{op1\, |
|000007e0| 6f 70 32 7d 0a 20 20 52 | 65 74 75 72 6e 20 74 68 |op2}. R|eturn th|
|000007f0| 65 20 67 72 65 61 74 65 | 73 74 20 63 6f 6d 6d 6f |e greate|st commo|
|00000800| 6e 20 64 69 76 69 73 6f | 72 20 6f 66 20 5c 76 61 |n diviso|r of \va|
|00000810| 72 7b 6f 70 31 7d 20 61 | 6e 64 20 5c 76 61 72 7b |r{op1} a|nd \var{|
|00000820| 6f 70 32 7d 2e 0a 5c 65 | 6e 64 7b 66 75 6e 63 64 |op2}..\e|nd{funcd|
|00000830| 65 73 63 7d 0a 0a 5c 62 | 65 67 69 6e 7b 66 75 6e |esc}..\b|egin{fun|
|00000840| 63 64 65 73 63 7d 7b 67 | 63 64 65 78 74 7d 7b 61 |cdesc}{g|cdext}{a|
|00000850| 5c 2c 20 62 7d 0a 20 20 | 52 65 74 75 72 6e 20 61 |\, b}. |Return a|
|00000860| 20 74 75 70 6c 65 20 5c | 63 6f 64 65 7b 28 5c 76 | tuple \|code{(\v|
|00000870| 61 72 7b 67 7d 2c 20 5c | 76 61 72 7b 73 7d 2c 20 |ar{g}, \|var{s}, |
|00000880| 5c 76 61 72 7b 74 7d 29 | 7d 2c 20 73 75 63 68 20 |\var{t})|}, such |
|00000890| 74 68 61 74 0a 20 20 5c | 63 6f 64 65 7b 5c 76 61 |that. \|code{\va|
|000008a0| 72 7b 61 7d 2a 5c 76 61 | 72 7b 73 7d 20 2b 20 5c |r{a}*\va|r{s} + \|
|000008b0| 76 61 72 7b 62 7d 2a 5c | 76 61 72 7b 74 7d 20 3d |var{b}*\|var{t} =|
|000008c0| 3d 20 5c 76 61 72 7b 67 | 7d 20 3d 3d 20 67 63 64 |= \var{g|} == gcd|
|000008d0| 28 5c 76 61 72 7b 61 7d | 2c 20 5c 76 61 72 7b 62 |(\var{a}|, \var{b|
|000008e0| 7d 29 7d 2e 0a 5c 65 6e | 64 7b 66 75 6e 63 64 65 |})}..\en|d{funcde|
|000008f0| 73 63 7d 0a 0a 5c 62 65 | 67 69 6e 7b 66 75 6e 63 |sc}..\be|gin{func|
|00000900| 64 65 73 63 7d 7b 73 71 | 72 74 7d 7b 6f 70 7d 0a |desc}{sq|rt}{op}.|
|00000910| 20 20 52 65 74 75 72 6e | 20 74 68 65 20 73 71 75 | Return| the squ|
|00000920| 61 72 65 20 72 6f 6f 74 | 20 6f 66 20 5c 76 61 72 |are root| of \var|
|00000930| 7b 6f 70 7d 2e 20 54 68 | 65 20 72 65 73 75 6c 74 |{op}. Th|e result|
|00000940| 20 69 73 20 72 6f 75 6e | 64 65 64 20 74 6f 77 61 | is roun|ded towa|
|00000950| 72 64 73 20 7a 65 72 6f | 2e 0a 5c 65 6e 64 7b 66 |rds zero|..\end{f|
|00000960| 75 6e 63 64 65 73 63 7d | 0a 0a 5c 62 65 67 69 6e |uncdesc}|..\begin|
|00000970| 7b 66 75 6e 63 64 65 73 | 63 7d 7b 73 71 72 74 72 |{funcdes|c}{sqrtr|
|00000980| 65 6d 7d 7b 6f 70 7d 0a | 20 20 52 65 74 75 72 6e |em}{op}.| Return|
|00000990| 20 61 20 74 75 70 6c 65 | 20 5c 63 6f 64 65 7b 28 | a tuple| \code{(|
|000009a0| 5c 76 61 72 7b 72 6f 6f | 74 7d 2c 20 5c 76 61 72 |\var{roo|t}, \var|
|000009b0| 7b 72 65 6d 61 69 6e 64 | 65 72 7d 29 7d 2c 20 73 |{remaind|er})}, s|
|000009c0| 75 63 68 20 74 68 61 74 | 0a 20 20 5c 63 6f 64 65 |uch that|. \code|
|000009d0| 7b 5c 76 61 72 7b 72 6f | 6f 74 7d 2a 5c 76 61 72 |{\var{ro|ot}*\var|
|000009e0| 7b 72 6f 6f 74 7d 20 2b | 20 5c 76 61 72 7b 72 65 |{root} +| \var{re|
|000009f0| 6d 61 69 6e 64 65 72 7d | 20 3d 3d 20 5c 76 61 72 |mainder}| == \var|
|00000a00| 7b 6f 70 7d 7d 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |{op}}..\|end{func|
|00000a10| 64 65 73 63 7d 0a 0a 5c | 62 65 67 69 6e 7b 66 75 |desc}..\|begin{fu|
|00000a20| 6e 63 64 65 73 63 7d 7b | 64 69 76 6d 7d 7b 6e 75 |ncdesc}{|divm}{nu|
|00000a30| 6d 65 72 61 74 6f 72 5c | 2c 20 64 65 6e 6f 6d 69 |merator\|, denomi|
|00000a40| 6e 61 74 6f 72 5c 2c 20 | 6d 6f 64 75 6c 75 73 7d |nator\, |modulus}|
|00000a50| 0a 20 20 52 65 74 75 72 | 6e 73 20 61 20 6e 75 6d |. Retur|ns a num|
|00000a60| 62 65 72 20 5c 76 61 72 | 7b 71 7d 2e 20 73 75 63 |ber \var|{q}. suc|
|00000a70| 68 20 74 68 61 74 0a 20 | 20 5c 63 6f 64 65 7b 5c |h that. | \code{\|
|00000a80| 76 61 72 7b 71 7d 20 2a | 20 5c 76 61 72 7b 64 65 |var{q} *| \var{de|
|00000a90| 6e 6f 6d 69 6e 61 74 6f | 72 7d 20 5c 25 7b 7d 20 |nominato|r} \%{} |
|00000aa0| 5c 76 61 72 7b 6d 6f 64 | 75 6c 75 73 7d 20 3d 3d |\var{mod|ulus} ==|
|00000ab0| 20 5c 76 61 72 7b 6e 75 | 6d 65 72 61 74 6f 72 7d | \var{nu|merator}|
|00000ac0| 7d 2e 0a 20 20 4f 6e 65 | 20 63 6f 75 6c 64 20 61 |}.. One| could a|
|00000ad0| 6c 73 6f 20 69 6d 70 6c | 65 6d 65 6e 74 20 74 68 |lso impl|ement th|
|00000ae0| 69 73 20 66 75 6e 63 74 | 69 6f 6e 20 69 6e 20 50 |is funct|ion in P|
|00000af0| 79 74 68 6f 6e 2c 20 75 | 73 69 6e 67 20 5c 63 6f |ython, u|sing \co|
|00000b00| 64 65 7b 67 63 64 65 78 | 74 7d 2e 0a 5c 65 6e 64 |de{gcdex|t}..\end|
|00000b10| 7b 66 75 6e 63 64 65 73 | 63 7d 0a 0a 41 6e 20 6d |{funcdes|c}..An m|
|00000b20| 70 7a 2d 6e 75 6d 62 65 | 72 20 68 61 73 20 6f 6e |pz-numbe|r has on|
|00000b30| 65 20 6d 65 74 68 6f 64 | 3a 0a 0a 5c 72 65 6e 65 |e method|:..\rene|
|00000b40| 77 63 6f 6d 6d 61 6e 64 | 7b 5c 69 6e 64 65 78 73 |wcommand|{\indexs|
|00000b50| 75 62 69 74 65 6d 7d 7b | 28 6d 70 7a 20 6d 65 74 |ubitem}{|(mpz met|
|00000b60| 68 6f 64 29 7d 0a 5c 62 | 65 67 69 6e 7b 66 75 6e |hod)}.\b|egin{fun|
|00000b70| 63 64 65 73 63 7d 7b 62 | 69 6e 61 72 79 7d 7b 7d |cdesc}{b|inary}{}|
|00000b80| 0a 20 20 43 6f 6e 76 65 | 72 74 20 74 68 69 73 20 |. Conve|rt this |
|00000b90| 6d 70 7a 2d 6e 75 6d 62 | 65 72 20 74 6f 20 61 20 |mpz-numb|er to a |
|00000ba0| 62 69 6e 61 72 79 20 73 | 74 72 69 6e 67 2c 20 77 |binary s|tring, w|
|00000bb0| 68 65 72 65 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |here the| number |
|00000bc0| 68 61 73 20 62 65 65 6e | 0a 20 20 73 74 6f 72 65 |has been|. store|
|00000bd0| 64 20 61 73 20 61 6e 20 | 61 72 72 61 79 20 6f 66 |d as an |array of|
|00000be0| 20 72 61 64 69 78 2d 32 | 35 36 20 64 69 67 69 74 | radix-2|56 digit|
|00000bf0| 73 2c 20 6c 65 61 73 74 | 20 73 69 67 6e 69 66 69 |s, least| signifi|
|00000c00| 63 61 6e 74 20 64 69 67 | 69 74 20 66 69 72 73 74 |cant dig|it first|
|00000c10| 2e 0a 0a 20 20 54 68 65 | 20 6d 70 7a 2d 6e 75 6d |... The| mpz-num|
|00000c20| 62 65 72 20 6d 75 73 74 | 20 68 61 76 65 20 61 20 |ber must| have a |
|00000c30| 76 61 6c 75 65 20 67 72 | 65 61 74 65 72 20 74 68 |value gr|eater th|
|00000c40| 61 6e 20 6f 72 20 65 71 | 75 61 6c 20 74 6f 20 7a |an or eq|ual to z|
|00000c50| 65 72 6f 2c 0a 20 20 6f | 74 68 65 72 77 69 73 65 |ero,. o|therwise|
|00000c60| 20 61 20 5c 63 6f 64 65 | 7b 56 61 6c 75 65 45 72 | a \code|{ValueEr|
|00000c70| 72 6f 72 7d 2d 65 78 63 | 65 70 74 69 6f 6e 20 77 |ror}-exc|eption w|
|00000c80| 69 6c 6c 20 62 65 20 72 | 61 69 73 65 64 2e 0a 5c |ill be r|aised..\|
|00000c90| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 0a |end{func|desc}. |
+--------+-------------------------+-------------------------+--------+--------+