FLINT3.7.0-dev

gr_generic_bin, gr_generic_bin_ui, gr_generic_bin_uiui, gr_generic_bin_vec, gr_generic_bin_ui_vec

Synopsis#include <flint/gr_special.h>
int gr_generic_bin(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx)source
int gr_generic_bin_ui(gr_ptr res, gr_srcptr x, ulong y, gr_ctx_t ctx)source
int gr_generic_bin_uiui(gr_ptr res, ulong x, ulong y, gr_ctx_t ctx)source
int gr_generic_bin_vec(gr_ptr res, gr_srcptr x, slong len, gr_ctx_t ctx)source
int gr_generic_bin_ui_vec(gr_ptr res, ulong x, slong len, gr_ctx_t ctx)source

Binomial coefficients: gr_generic_bin_uiui uses fmpz_bin_uiui in \mathbb{Z}, and in other rings computes the integer exactly and converts it when n \le 100 or the ring is exact of characteristic zero, and otherwise divides a falling factorial by a factorial in the ring (falling back to the exact integer if the division fails). gr_generic_bin_ui divides the falling factorial x (x-1) \cdots (x-k+1) by k!; gr_generic_bin requires an integer y. The vec versions use recurrences between consecutive coefficients, taking care in rings of finite characteristic where divisions may not be possible.

Cite this page

The FLINT team, “gr_generic_bin, gr_generic_bin_ui, gr_generic_bin_uiui, gr_generic_bin_vec, gr_generic_bin_ui_vec (gr_special.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_special/gr_generic_bin.html (generated 2026-10-20).