FLINT3.7.0-dev

fmpq_next_minimal, _fmpq_next_minimal

Synopsis#include <flint/fmpq.h>
void fmpq_next_minimal(fmpq_t res, const fmpq_t x)source
void _fmpq_next_minimal(fmpz_t rnum, fmpz_t rden, const fmpz_t num, const fmpz_t den)source

Given a nonnegative canonical x, set the result to the next element of the enumeration of the nonnegative rationals by increasing height \max(p, q): for q = 1, 2, 3, \ldots the fractions p/q and q/p for 1 \le p < q coprime to q, in increasing order of p. Starting from zero, every nonnegative rational is generated exactly once: 0, 1, 1/2, 2, 1/3, 3, 2/3, 3/2, 1/4, 4, 3/4, 4/3, 1/5, 5, 2/5, \ldots

Finding the next p coprime to q needs GCDs, so this enumeration is somewhat slower than fmpq_next_calkin_wilf.

Cite this page

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