<< NL_S_GCDIterative NL_S: Security NL_S_ISMultiPath >>

NARVAL >> NL_S: Security > NL_S_GCDRecursive

NL_S_GCDRecursive

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

Calling Sequence

[G] = NL_S_GCDRecursive(A,B)

Arguments

A :

Integer.

B :

Integer.

G :

Greatest common divisor.

Description

NL_S_GCDRecursive 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]=NL_S_GCDRecursive(a,b)//application of NL_S_GCDRecursive
a=10;//integer
b=3;//integer
[g]=NL_S_GCDRecursive(a,b)//application of NL_S_GCDRecursive

Report an issue
<< NL_S_GCDIterative NL_S: Security NL_S_ISMultiPath >>