<< NL_S_Dec2Bin NL_S: Security NL_S_GCDExtended >>

NARVAL >> NL_S: Security > NL_S_GCD

NL_S_GCD

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

Calling Sequence

[G] = NL_S_GCD(A,B)

Arguments

A :

Integer.

B :

Integer.

G :

Greatest common divisor.

Description

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

Report an issue
<< NL_S_Dec2Bin NL_S: Security NL_S_GCDExtended >>