Policies & Guidelines

GREATEST_COMMON_DIVISOR

Calculate greatest common divisor

Description

Given an array of numbers, calculates the greatest common divisor for them.

Function signature

GREATEST_COMMON_DIVISOR(array: Array) => Number

Parameter

Description

Array

Array of numeric values

Examples

Formula

Return value

GREATEST_COMMON_DIVISOR([10, 100, 1000])

10

GREATEST_COMMON_DIVISOR([14, 21, 42])

7

GREATEST_COMMON_DIVISOR([12, 9, 15])

3