August 23, 2024

P33 - Determine whether two positive integer numbers are coprime.

Two numbers are coprime if their greatest common divisor equals 1.

> p33:coprime(32, 33).
    true

erlang

%Determine whether two positive integer numbers are coprime.
-module(p33).
-export([coprime/2]).

coprime(A, B) ->
    p32:gcd(A, B) == 1.
Be first to comment
Leave a reply