On 25th of January 2020, Dean Rasheed committed patch:
Add functions gcd() and lcm() for integer and numeric types. These compute the greatest common divisor and least common multiple of a pair of numbers using the Euclidean algorithm. Vik Fearing, reviewed by Fabien Coelho. Discussion: https://postgr.es/m/adbd3e0b-e3f1-5bbc-21db-03caf1cef0f7@2ndquadrant.com
Description is pretty clear, but let's see it in action.
=$ SELECT gcd(292215::NUMERIC, 423430::NUMERIC), lcm(292215::NUMERIC, 423430::NUMERIC); gcd | lcm -----+----------- 805 | 153705090 (1 ROW) TIME: 1.243 ms
Looks reasonable. It's not a very common use case, but it definitely can be useful, so thanks to all involved.
Your discussion link is broken
@Joe:
thanks, fixed. It’s due to a bug in auto-linking on git.postgresql.org. Mailed team in https://www.postgresql.org/message-id/20200130120246.GA15565%40depesz.com