FLINT3.7.0-dev

n_discrete_log_bsgs

Synopsis#include <flint/ulong_extras.h>
ulong n_discrete_log_bsgs(ulong b, ulong a, ulong n)source

Returns xx with ax≡b(modn)a^x \equiv b \pmod n by baby-step giant-step [Sha1971], assuming (Z/nZ)×(\mathbb{Z}/n\mathbb{Z})^\times is cyclic, that is, nn is 2, 4, pkp^k or 2pk2p^k for an odd prime pp.

References#

  • [Sha1971] D. Shanks, "Class number, a theory of factorization, and genera", Proc. Symp. Pure Math. 20, American Mathematical Society (1971), 415–440
Cite this page

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