FLINT3.7.0-dev

n_gcd

Synopsis#include <flint/ulong_extras.h>
ulong n_gcd(ulong x, ulong y)source

Returns \gcd(x, y), with \gcd(x, 0) = \gcd(0, x) = x.

n_gcd removes common factors of 2 and calls GMP's mpn_gcd_11 (or mpn_gcd_1 when GMP internals are not available), a binary algorithm [Knu1997].

Guides#

References#

  • [Knu1997] Knuth, D. E. The Art of Computer Programming, volume 2: Seminumerical algorithms, 1997
Cite this page

The FLINT team, “n_gcd (ulong_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ulong_extras/n_gcd.html (generated 2026-10-20).