%% %% This is file `xintgcd.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% xint.dtx (with options: `xintgcd') %% %% IMPORTANT NOTICE: %% %% For the copyright see the source file. %% %% Any modified versions of this file must be renamed %% with new filenames distinct from xintgcd.sty. %% %% For distribution of the original source see the terms %% for copying and modification in the file xint.dtx. %% %% This generated file may be distributed as long as the %% original source files, as listed above, are part of the %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% %%---------------------------------------------------------------- %% The xint bundle (version 1.08b of June 14, 2013) %% xintgcd: Euclidean algorithm with xint package %% Copyright (C) 2013 by Jean-Francois Burnol %%---------------------------------------------------------------- %% \begingroup\catcode61\catcode48\catcode32=10\relax% \catcode13=5 % ^^M \endlinechar=13 % \catcode123=1 % { \catcode125=2 % } \catcode64=11 % @ \catcode35=6 % # \catcode44=12 % , \catcode45=12 % - \catcode46=12 % . \catcode58=12 % : \def\space { }% \let\z\endgroup \expandafter\let\expandafter\x\csname ver@xintgcd.sty\endcsname \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname \expandafter \ifx\csname PackageInfo\endcsname\relax \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}% \else \def\y#1#2{\PackageInfo{#1}{#2}}% \fi \expandafter \ifx\csname numexpr\endcsname\relax \y{xintgcd}{\numexpr not available, aborting input}% \aftergroup\endinput \else \ifx\x\relax % plain-TeX, first loading of xintgcd.sty \ifx\w\relax % but xint.sty not yet loaded. \y{xintgcd}{Package xint is required}% \y{xintgcd}{Will try \string\input\space xint.sty}% \def\z{\endgroup\input xint.sty\relax}% \fi \else \def\empty {}% \ifx\x\empty % LaTeX, first loading, % variable is initialized, but \ProvidesPackage not yet seen \ifx\w\relax % xint.sty not yet loaded. \y{xintgcd}{Package xint is required}% \y{xintgcd}{Will try \string\RequirePackage{xint}}% \def\z{\endgroup\RequirePackage{xint}}% \fi \else \y{xintgcd}{I was already loaded, aborting input}% \aftergroup\endinput \fi \fi \fi \z% \begingroup\catcode61\catcode48\catcode32=10\relax% \catcode13=5 % ^^M \endlinechar=13 % \catcode123=1 % { \catcode125=2 % } \catcode64=11 % @ \catcode35=6 % # \catcode44=12 % , \catcode45=12 % - \catcode46=12 % . \catcode58=12 % : \expandafter \ifx\csname PackageInfo\endcsname\relax \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}% \else \def\y#1#2{\PackageInfo{#1}{#2}}% \fi \def\empty {}% \expandafter\let\expandafter\w\csname ver@xint.sty\endcsname \ifx\w\relax % Plain TeX, user gave a file name at the prompt \y{xintgcd}{Loading of package xint failed, aborting input}% \aftergroup\endinput \fi \ifx\w\empty % LaTeX, user gave a file name at the prompt \y{xintgcd}{Loading of package xint failed, aborting input}% \aftergroup\endinput \fi \endgroup% \begingroup\catcode61\catcode48\catcode32=10\relax% \catcode13=5 % ^^M \endlinechar=13 % \catcode123=1 % { \catcode125=2 % } \catcode95=11 % _ \def\x {% \endgroup \edef\XINT_gcd_restorecatcodes_endinput {% \catcode36=\the\catcode36 % $ \catcode94=\the\catcode94 % ^ \catcode96=\the\catcode96 % ` \catcode47=\the\catcode47 % / \catcode41=\the\catcode41 % ) \catcode40=\the\catcode40 % ( \catcode42=\the\catcode42 % * \catcode43=\the\catcode43 % + \catcode62=\the\catcode62 % > \catcode60=\the\catcode60 % < \catcode58=\the\catcode58 % : \catcode46=\the\catcode46 % . \catcode45=\the\catcode45 % - \catcode44=\the\catcode44 % , \catcode35=\the\catcode35 % # \catcode95=\the\catcode95 % _ \catcode125=\the\catcode125 % } \catcode123=\the\catcode123 % { \endlinechar=\the\endlinechar \catcode13=\the\catcode13 % ^^M \catcode32=\the\catcode32 % \catcode61=\the\catcode61\relax % = \noexpand\endinput }% \XINT_setcatcodes % defined in xint.sty \catcode36=3 % $ }% \x \begingroup \catcode64=11 % @ \catcode91=12 % [ \catcode93=12 % ] \catcode58=12 % : \expandafter\ifx\csname ProvidesPackage\endcsname\relax \def\x#1#2#3[#4]{\endgroup \immediate\write-1{Package: #3 #4}% \xdef#1{#4}% }% \else \def\x#1#2[#3]{\endgroup #2[{#3}]% \ifx#1\@undefined \xdef#1{#3}% \fi \ifx#1\relax \xdef#1{#3}% \fi }% \fi \expandafter\x\csname ver@xintgcd.sty\endcsname \ProvidesPackage{xintgcd}% [2013/06/14 v1.08b Euclide algorithm with xint package (jfB)]% \def\xintGCD {\romannumeral0\xintgcd }% \def\xintgcd #1% {% \expandafter\XINT_gcd\expandafter{\romannumeral0\xintiabs {#1}}% }% \def\XINT_gcd #1#2% {% \expandafter\XINT_gcd_fork\romannumeral0\xintiabs {#2}\Z #1\Z }% \def\XINT_gcd_fork #1#2\Z #3#4\Z {% \xint_UDzerofork #1\dummy \XINT_gcd_BisZero #3\dummy \XINT_gcd_AisZero 0\dummy \XINT_gcd_loop \krof {#1#2}{#3#4}% }% \def\XINT_gcd_AisZero #1#2{ #1}% \def\XINT_gcd_BisZero #1#2{ #2}% \def\XINT_gcd_CheckRem #1#2\Z {% \xint_gob_til_zero #1\xint_gcd_end0\XINT_gcd_loop {#1#2}% }% \def\xint_gcd_end0\XINT_gcd_loop #1#2{ #2}% \def\XINT_gcd_loop #1#2% {% \expandafter\expandafter\expandafter \XINT_gcd_CheckRem \expandafter\xint_secondoftwo \romannumeral0\XINT_div_prepare {#1}{#2}\Z {#1}% }% \def\xintBezout {\romannumeral0\xintbezout }% \def\xintbezout #1% {% \expandafter\xint_bezout\expandafter {\romannumeral-`0#1}% }% \def\xint_bezout #1#2% {% \expandafter\XINT_bezout_fork \romannumeral-`0#2\Z #1\Z }% \def\XINT_bezout_fork #1#2\Z #3#4\Z {% \xint_UDzerosfork #1#3\dummy \XINT_bezout_botharezero #10\dummy \XINT_bezout_secondiszero #30\dummy \XINT_bezout_firstiszero 00\dummy {\xint_UDsignsfork #1#3\dummy \XINT_bezout_minusminus % A < 0, B < 0 #1-\dummy \XINT_bezout_minusplus % A > 0, B < 0 #3-\dummy \XINT_bezout_plusminus % A < 0, B > 0 --\dummy \XINT_bezout_plusplus % A > 0, B > 0 \krof }% \krof {#2}{#4}#1#3{#3#4}{#1#2}% #1#2=B, #3#4=A }% \def\XINT_bezout_botharezero #1#2#3#4#5#6% {% \xintError:NoBezoutForZeros \space {0}{0}{0}{0}{0}% }% \def\XINT_bezout_firstiszero #1#2#3#4#5#6% {% \xint_UDsignfork #3\dummy { {0}{#3#1}{0}{1}{#1}}% -\dummy { {0}{#3#1}{0}{-1}{#1}}% \krof }% \def\XINT_bezout_secondiszero #1#2#3#4#5#6% {% \xint_UDsignfork #4\dummy{ {#4#2}{0}{-1}{0}{#2}}% -\dummy{ {#4#2}{0}{1}{0}{#2}}% \krof }% \def\XINT_bezout_minusminus #1#2#3#4% {% \expandafter\XINT_bezout_mm_post \romannumeral0\XINT_bezout_loop_a 1{#1}{#2}1001% }% \def\XINT_bezout_mm_post #1#2% {% \expandafter\XINT_bezout_mm_postb\expandafter {\romannumeral0\xintiopp{#2}}{\romannumeral0\xintiopp{#1}}% }% \def\XINT_bezout_mm_postb #1#2% {% \expandafter\XINT_bezout_mm_postc\expandafter {#2}{#1}% }% \def\XINT_bezout_mm_postc #1#2#3#4#5% {% \space {#4}{#5}{#1}{#2}{#3}% }% \def\XINT_bezout_minusplus #1#2#3#4% {% \expandafter\XINT_bezout_mp_post \romannumeral0\XINT_bezout_loop_a 1{#1}{#4#2}1001% }% \def\XINT_bezout_mp_post #1#2% {% \expandafter\XINT_bezout_mp_postb\expandafter {\romannumeral0\xintiopp {#2}}{#1}% }% \def\XINT_bezout_mp_postb #1#2#3#4#5% {% \space {#4}{#5}{#2}{#1}{#3}% }% \def\XINT_bezout_plusminus #1#2#3#4% {% \expandafter\XINT_bezout_pm_post \romannumeral0\XINT_bezout_loop_a 1{#3#1}{#2}1001% }% \def\XINT_bezout_pm_post #1% {% \expandafter \XINT_bezout_pm_postb \expandafter {\romannumeral0\xintiopp{#1}}% }% \def\XINT_bezout_pm_postb #1#2#3#4#5% {% \space {#4}{#5}{#1}{#2}{#3}% }% \def\XINT_bezout_plusplus #1#2#3#4% {% \expandafter\XINT_bezout_pp_post \romannumeral0\XINT_bezout_loop_a 1{#3#1}{#4#2}1001% }% \def\XINT_bezout_pp_post #1#2#3#4#5% {% \space {#4}{#5}{#1}{#2}{#3}% }% \def\XINT_bezout_loop_a #1#2#3% {% \expandafter\XINT_bezout_loop_b \expandafter{\the\numexpr -#1\expandafter }% \romannumeral0\XINT_div_prepare {#2}{#3}{#2}% }% \def\XINT_bezout_loop_b #1#2#3#4#5#6#7#8% {% \expandafter \XINT_bezout_loop_c \expandafter {\romannumeral0\xintiadd{\XINT_Mul{#5}{#2}}{#7}}% {\romannumeral0\xintiadd{\XINT_Mul{#6}{#2}}{#8}}% {#1}{#3}{#4}{#5}{#6}% }% \def\XINT_bezout_loop_c #1#2% {% \expandafter \XINT_bezout_loop_d \expandafter {#2}{#1}% }% \def\XINT_bezout_loop_d #1#2#3#4#5% {% \XINT_bezout_loop_e #4\Z {#3}{#5}{#2}{#1}% }% \def\XINT_bezout_loop_e #1#2\Z {% \xint_gob_til_zero #1\xint_bezout_loop_exit0\XINT_bezout_loop_f {#1#2}% }% \def\XINT_bezout_loop_f #1#2% {% \XINT_bezout_loop_a {#2}{#1}% }% \def\xint_bezout_loop_exit0\XINT_bezout_loop_f #1#2% {% \ifcase #2 \or \expandafter\XINT_bezout_exiteven \else\expandafter\XINT_bezout_exitodd \fi }% \def\XINT_bezout_exiteven #1#2#3#4#5% {% \space {#5}{#4}{#1}% }% \def\XINT_bezout_exitodd #1#2#3#4#5% {% \space {-#5}{-#4}{#1}% }% \def\xintEuclideAlgorithm {\romannumeral0\xinteuclidealgorithm }% \def\xinteuclidealgorithm #1% {% \expandafter \XINT_euc \expandafter{\romannumeral0\xintiabs {#1}}% }% \def\XINT_euc #1#2% {% \expandafter\XINT_euc_fork \romannumeral0\xintiabs {#2}\Z #1\Z }% \def\XINT_euc_fork #1#2\Z #3#4\Z {% \xint_UDzerofork #1\dummy \XINT_euc_BisZero #3\dummy \XINT_euc_AisZero 0\dummy \XINT_euc_a \krof {0}{#1#2}{#3#4}{{#3#4}{#1#2}}{}\Z }% \def\XINT_euc_AisZero #1#2#3#4#5#6{ {1}{0}{#2}{#2}{0}{0}}% \def\XINT_euc_BisZero #1#2#3#4#5#6{ {1}{0}{#3}{#3}{0}{0}}% \def\XINT_euc_a #1#2#3% {% \expandafter\XINT_euc_b \expandafter {\the\numexpr #1+1\expandafter }% \romannumeral0\XINT_div_prepare {#2}{#3}{#2}% }% \def\XINT_euc_b #1#2#3#4% {% \XINT_euc_c #3\Z {#1}{#3}{#4}{{#2}{#3}}% }% \def\XINT_euc_c #1#2\Z {% \xint_gob_til_zero #1\xint_euc_end0\XINT_euc_a }% \def\xint_euc_end0\XINT_euc_a #1#2#3#4\Z% {% \expandafter\xint_euc_end_ \romannumeral0% \XINT_rord_main {}#4{{#1}{#3}}% \xint_relax \xint_undef\xint_undef\xint_undef\xint_undef \xint_undef\xint_undef\xint_undef\xint_undef \xint_relax }% \def\xint_euc_end_ #1#2#3% {% \space {#1}{#3}{#2}% }% \def\xintBezoutAlgorithm {\romannumeral0\xintbezoutalgorithm }% \def\xintbezoutalgorithm #1% {% \expandafter \XINT_bezalg \expandafter{\romannumeral0\xintiabs {#1}}% }% \def\XINT_bezalg #1#2% {% \expandafter\XINT_bezalg_fork \romannumeral0\xintiabs {#2}\Z #1\Z }% \def\XINT_bezalg_fork #1#2\Z #3#4\Z {% \xint_UDzerofork #1\dummy \XINT_bezalg_BisZero #3\dummy \XINT_bezalg_AisZero 0\dummy \XINT_bezalg_a \krof 0{#1#2}{#3#4}1001{{#3#4}{#1#2}}{}\Z }% \def\XINT_bezalg_AisZero #1#2#3\Z{ {1}{0}{0}{1}{#2}{#2}{1}{0}{0}{0}{0}{1}}% \def\XINT_bezalg_BisZero #1#2#3#4\Z{ {1}{0}{0}{1}{#3}{#3}{1}{0}{0}{0}{0}{1}}% \def\XINT_bezalg_a #1#2#3% {% \expandafter\XINT_bezalg_b \expandafter {\the\numexpr #1+1\expandafter }% \romannumeral0\XINT_div_prepare {#2}{#3}{#2}% }% \def\XINT_bezalg_b #1#2#3#4#5#6#7#8% {% \expandafter\XINT_bezalg_c\expandafter {\romannumeral0\xintiadd {\xintiMul {#6}{#2}}{#8}}% {\romannumeral0\xintiadd {\xintiMul {#5}{#2}}{#7}}% {#1}{#2}{#3}{#4}{#5}{#6}% }% \def\XINT_bezalg_c #1#2#3#4#5#6% {% \expandafter\XINT_bezalg_d\expandafter {#2}{#3}{#4}{#5}{#6}{#1}% }% \def\XINT_bezalg_d #1#2#3#4#5#6#7#8% {% \XINT_bezalg_e #4\Z {#2}{#4}{#5}{#1}{#6}{#7}{#8}{{#3}{#4}{#1}{#6}}% }% \def\XINT_bezalg_e #1#2\Z {% \xint_gob_til_zero #1\xint_bezalg_end0\XINT_bezalg_a }% \def\xint_bezalg_end0\XINT_bezalg_a #1#2#3#4#5#6#7#8\Z {% \expandafter\xint_bezalg_end_ \romannumeral0% \XINT_rord_main {}#8{{#1}{#3}}% \xint_relax \xint_undef\xint_undef\xint_undef\xint_undef \xint_undef\xint_undef\xint_undef\xint_undef \xint_relax }% \def\xint_bezalg_end_ #1#2#3#4% {% \space {#1}{#3}{0}{1}{#2}{#4}{1}{0}% }% \def\xintTypesetEuclideAlgorithm #1#2% {% l'algo remplace #1 et #2 par |#1| et |#2| \par \begingroup \xintAssignArray\xintEuclideAlgorithm {#1}{#2}\to\U \edef\A{\U2}\edef\B{\U4}\edef\N{\U1}% \setbox 0 \vbox{\halign {$##$\cr \A\cr \B \cr}}% \noindent \count 255 1 \loop \hbox to \wd 0 {\hfil$\U{\numexpr 2*\count 255\relax}$}% ${} = \U{\numexpr 2*\count 255 + 3\relax} \times \U{\numexpr 2*\count 255 + 2\relax} + \U{\numexpr 2*\count 255 + 4\relax}$% \ifnum \count 255 < \N \hfill\break \advance \count 255 1 \repeat \par \endgroup }% \def\xintTypesetBezoutAlgorithm #1#2% {% \par \begingroup \parindent0pt \xintAssignArray\xintBezoutAlgorithm {#1}{#2}\to\BEZ \edef\A{\BEZ2}\edef\B{\BEZ6}\edef\N{\BEZ1}% A = |#1|, B = |#2| \setbox 0 \vbox{\halign {$##$\cr \A\cr \B \cr}}% \count 255 1 \loop \noindent \hbox to \wd 0 {\hfil$\BEZ{4*\count 255 - 2}$}% ${} = \BEZ{4*\count 255 + 5} \times \BEZ{4*\count 255 + 2} + \BEZ{4*\count 255 + 6}$\hfill\break \hbox to \wd 0 {\hfil$\BEZ{4*\count 255 +7}$}% ${} = \BEZ{4*\count 255 + 5} \times \BEZ{4*\count 255 + 3} + \BEZ{4*\count 255 - 1}$\hfill\break \hbox to \wd 0 {\hfil$\BEZ{4*\count 255 +8}$}% ${} = \BEZ{4*\count 255 + 5} \times \BEZ{4*\count 255 + 4} + \BEZ{4*\count 255 }$ \endgraf \ifnum \count 255 < \N \advance \count 255 1 \repeat \par \edef\U{\BEZ{4*\N + 4}}% \edef\V{\BEZ{4*\N + 3}}% \edef\D{\BEZ5}% \ifodd\N $\U\times\A - \V\times \B = -\D$% \else $\U\times\A - \V\times\B = \D$% \fi \par \endgroup }% \XINT_gcd_restorecatcodes_endinput% \endinput %% %% End of file `xintgcd.sty'.