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 csv dictionaries feedhandler finance functions ingestion ipc iterators math optimizations realtime sql streaming strings tables temporal websockets

Email sent!

Email not sent