<< NARVAL_S_ExtGcd NARVAL NARVAL_S_GcdIter >>

NARVAL >> NARVAL > NARVAL_S_Gcd

NARVAL_S_Gcd

Perform the greatest common divisor between two integers (Euclidian algorithm).

Calling Sequence

[g] = NARVAL_S_Gcd(a,b)

Parameters

a :

integer.

b :

integer.

g :

greatest common divisor.

Description

NARVAL_S_Gcd performs the greatest common divisor (GCD) g of the two integers a and b in respect with the Euclidian algorithm (WIKIPEDIA).

Pseudo-Code (Wikipedia)

function gcd(a, b)
    while b  0
       t := b
       b := a mod b
       a := t
    return a

Examples

a=136;//integer
b=867;//integer
[g]=NARVAL_S_Gcd(a,b);//application of NARVAL_S_Gcd
g
a=10;//integer
b=3;//integer
[g]=NARVAL_S_Gcd(a,b);//application of NARVAL_S_Gcd
g

Authors

Foued Melakessou

Contact

Dr. Foued Melakessou

Research Associate

Interdisciplinary Centre for Security, Reliability and Trust

Room F106

University of Luxembourg

6, rue Coudenhove Kalergi

L-1359 Luxembourg-Kirchberg

E-mail: foued.melakessou@uni.lu

Tel: (+352) 46 66 44 5346

Home Page


<< NARVAL_S_ExtGcd NARVAL NARVAL_S_GcdIter >>