Difference between revisions of "GCD"
(elaborated) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
[[Category: Math Functions]] | [[Category: Math Functions]] | ||
− | == GCD( | + | == GCD(a, I) == |
− | Returns the greatest common divisor of an array of numbers. | + | Returns the greatest common divisor of an array of numbers. «a» should be an array of positive integers indexed by «<code>I</code>». |
+ | |||
+ | The greatest common divisor is the largest integer that divides evenly into all integers in «a». | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | :{| class="wikitable" | ||
+ | ! rowspan="2" | | ||
+ | ! colspan="3" |M ▶ | ||
+ | |- | ||
+ | ! 1 || 2 || 3 | ||
+ | |- | ||
+ | | a ▻ || 2297295 || 2457 || 10395 | ||
+ | |} | ||
+ | |||
+ | :<code>GCD(a,M) → 189</code> | ||
+ | |||
+ | :<code>GCD( [23*5, 23*7, 23*9, 23*11] ) → 23</code> | ||
== Library == | == Library == | ||
+ | To use this function, you must add the following library to your model. | ||
+ | |||
[[media:GCD function library.ana|GCD function library.ana]] | [[media:GCD function library.ana|GCD function library.ana]] | ||
== See Also == | == See Also == | ||
* [[media:GCD function library.ana |GCD function library.ana]] | * [[media:GCD function library.ana |GCD function library.ana]] | ||
− | * [[ | + | * [[Analytica_Libraries_and_Templates#Greatest_Common_Divisor_functions|Greatest Common Divisor functions]] |
* [[Mod]] | * [[Mod]] |
Latest revision as of 21:28, 24 March 2016
GCD(a, I)
Returns the greatest common divisor of an array of numbers. «a» should be an array of positive integers indexed by «I
».
The greatest common divisor is the largest integer that divides evenly into all integers in «a».
Examples
M ▶ 1 2 3 a ▻ 2297295 2457 10395
GCD(a,M) → 189
GCD( [23*5, 23*7, 23*9, 23*11] ) → 23
Library
To use this function, you must add the following library to your model.
See Also
Comments
Enable comment auto-refresher