Console Library 8.0.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
mr.h File Reference

提供基于 Miller-Rabin 算法的素数判定功能。 More...

#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  console
 本库所有组件所在的顶层命名空间。

Functions

uint64_t console::mod_mul (uint64_t a, uint64_t b, uint64_t mod) noexcept
 使用二进制加法模拟模乘。
uint64_t console::mod_pow (uint64_t a, uint64_t b, uint64_t mod) noexcept
 模幂运算。
bool console::miller_rabin_test (uint64_t n, uint64_t a) noexcept
 单次 Miller-Rabin 素性测试。
bool console::is_prime (uint64_t n) noexcept
 确定性素数判定。

Detailed Description

提供基于 Miller-Rabin 算法的素数判定功能。

本文件实现了针对 uint64_t 类型的高效素数判定,包含模乘、模幂、 Miller-Rabin 素性测试以及确定性小范围素数判断。

Author
MrXie1109
Date
2026