<< NARVAL_S_GcdIter NARVAL NARVAL_S_Prime >>

NARVAL >> NARVAL > NARVAL_S_GcdRec

NARVAL_S_GcdRec

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

Calling Sequence

[g] = NARVAL_S_GcdIter(a,b)

Parameters

a :

integer.

b :

integer.

g :

greatest common divisor.

Description

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

Pseudo-Code (Wikipedia)

function gcd(a, b)
    if b = 0
       return a
    else
       return gcd(b, a mod b)

Examples

a=136;//integer
b=867;//integer
[g]=NARVAL_S_GcdRec(a,b);//application of NARVAL_S_GcdRec
g
a=10;//integer
b=3;//integer
[g]=NARVAL_S_GcdRec(a,b);//application of NARVAL_S_GcdRec
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_GcdIter NARVAL NARVAL_S_Prime >>