makecoprime: Makes two integers coprime.

View source: R/domain.R

makecoprimeR Documentation

Makes two integers coprime.

Description

Divides both integers by their greatest common divisor, switching their signs if the second integer is negative. If either integer is 0, returns without modification.

Usage

makecoprime(a, b)

Arguments

a

An integer.

b

An integer.

Value

The greatest (positive) common divisor of two integers; if one of them is 0, returns the absolute value of the other number.

Examples

makecoprime(1, 2)
makecoprime(1, -2)
makecoprime(12, -18)
makecoprime(-12, 18)
makecoprime(15, 0)
makecoprime(0, -15)
makecoprime(0, 0)

genscore documentation built on May 31, 2023, 6:28 p.m.