fmpq_dedekind_sum, fmpq_dedekind_sum_naive
#include <flint/fmpq.h>Set to , for any integers and . The naive version evaluates the defining sum with terms. fmpq_dedekind_sum uses the continued fraction of and costs about as much as an extended GCD.
By the reciprocity law for coprime , the sum telescopes along the Euclidean algorithm [Hickerson1977]. With the partial quotients of , the convergent matrix and the alternating sum ,
The function evaluates this in machine words when fits in a slong and with the half-GCD continued fraction code otherwise. Writing in lowest terms, and .
References#
- [Hickerson1977] D. Hickerson, "Continued fractions and density results for Dedekind sums", Journal für die reine und angewandte Mathematik 290 (1977), 113–116.
The FLINT team, “fmpq_dedekind_sum, fmpq_dedekind_sum_naive (fmpq.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpq/fmpq_dedekind_sum.html (generated 2026-11-02).
@misc{flint-doc-fmpq-fmpq-dedekind-sum,
author = {{The FLINT team}},
title = {{fmpq\_dedekind\_sum, fmpq\_dedekind\_sum\_naive (fmpq.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpq/fmpq_dedekind_sum.html},
note = {Generated 2026-11-02}
}