numpy.gcd(arr1, arr2, out = None, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None) : This mathematical function helps user to calculate GCD value of |arr1| and |arr2| elements.
Greatest Common Divisor (GCD) of two or more numbers, which are not all zero, is the largest positive number that divides each of the numbers.
Example: Finding GCD of 120 and 2250
120 = 2^3 * 3 * 5 2250 = 2 * 3^2 * 5^3 Now, GCD of 120 and 2250 = 2 * 3 * 5 = 30
arr1 / arr2 : [array_like]Input array.
Return : Greatest Common Divisor (GCD) of two or more numbers.
arr1 : [120, 24, 42, 10] arr2 : [2250, 12, 20, 50] GCD of arr1 and arr2 : [30, 12, 2, 10] GCD of arr1 and 10 : [10, 2, 2, 10]
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Python - Read blob object in python using wand library
- MySQL-Connector-Python module in Python
- Reading Python File-Like Objects from C | Python
- Python | PRAW - Python Reddit API Wrapper
- Important differences between Python 2.x and Python 3.x with examples
- twitter-text-python (ttp) module - Python
- Python | Convert list to Python array
- Python | Index of Non-Zero elements in Python list
- Python | Merge Python key values to list
- Python | Add Logging to Python Libraries
- Python | Add Logging to a Python Script
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- Python | Visualizing O(n) using Python
- Use of min() and max() in Python
- Python PIP
- try-except vs If in Python
- Python if else
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.