Greatest Common Divisor

Question: Define a function 'gcd' that returns the greatest common divisor of two or more integers, as an integer.

More Information:

https://en.wikipedia.org/wiki/Greatest_common_divisor

Example

                                
                                q)gcd 10 5 15
5
q)gcd 5*til 100000
5
q)gcd 1+5*til 100000
1
                                
                            

Solution

Tags:
functions iterators math
Searchable Tags
algorithms api architecture asynchronous c csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime shared library sql statistics streaming strings tables temporal utility websockets