PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

gmp_hamdist> <gmp_gcd
Last updated: Fri, 18 Jul 2008

view this page in

gmp_gcdext

(PHP 4 >= 4.0.4, PHP 5)

gmp_gcdext — Calcola il MCD e moltiplicatori

Descrizione

array gmp_gcdext ( resource $a , resource $b )

Calcola g, s e t, in questo modo a*s + b*t = g = gcd(a,b), dove MCD è il massimo comune divisore. Restituisce un array con i rispettivi argomenti, cioè, g, s e t.



add a note add a note User Contributed Notes
gmp_gcdext
FatPhil
15-Jun-2003 06:47
The extended GCD can be used to calculate mutual modular inverses of two
coprime numbers. Internally gmp_invert uses this extended GCD routine,
but effectively throws away one of the inverses.

If gcd(a,b)=1, then r.a+s.b=1
Therefore  r.a == 1 (mod s) and s.b == 1 (mod r)
Note that one of r and s will be negative, and so you'll want to
canonicalise it.

gmp_hamdist> <gmp_gcd
Last updated: Fri, 18 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites