# 数论函数

素数与约数、最大公约数与模运算、欧拉函数、连分数、斐波那契数、伯努利数与卡特兰数，以及整数分拆。

53 个函数

## 有说明的函数

- [is_prime](https://zh.hilberon.com/library/is_prime)

  检验一个整数是否为素数。
- [divisors](https://zh.hilberon.com/library/divisors)

  一个整数的所有正因数，按从小到大排列。
- [euler_phi](https://zh.hilberon.com/library/euler_phi)

  欧拉函数：不超过 n 且与 n 互质的整数有多少个。
- [fibonacci](https://zh.hilberon.com/library/fibonacci)

  第 n 个斐波那契数，其中 F(1) = F(2) = 1。
- [modular_inverse](https://zh.hilberon.com/library/modular_inverse)

  一个整数在模另一个数下的逆元。
- [next_prime](https://zh.hilberon.com/library/next_prime)

  大于某个数的最小质数。
- [nth_prime](https://zh.hilberon.com/library/nth_prime)

  第 n 个质数，把 2 算作第一个。
- [power_mod](https://zh.hilberon.com/library/power_mod)

  幂对一个数取模：base^exponent mod modulus。
- [prime_pi](https://zh.hilberon.com/library/prime_pi)

  不超过某个数的质数个数。
- [bell_b](https://zh.hilberon.com/library/bell_b)

  第 n 个贝尔数：把 n 个物品分成若干组的方法数。
- [bernoulli_b](https://zh.hilberon.com/library/bernoulli_b)

  第 n 个伯努利数。
- [carmichael_lambda](https://zh.hilberon.com/library/carmichael_lambda)

  Carmichael 函数：使每个与 n 互质的数模 n 都变成 1 的最小幂次。
- [catalan_number](https://zh.hilberon.com/library/catalan_number)

  第 n 个 Catalan 数。
- [chinese_remainder](https://zh.hilberon.com/library/chinese_remainder)

  除以给定模数后余数为给定余数的那个数。
- [continued_fraction](https://zh.hilberon.com/library/continued_fraction)

  有理数的连分数，以列表形式给出。
- [convergents](https://zh.hilberon.com/library/convergents)

  连分数的渐近分数。
- [discrete_log](https://zh.hilberon.com/library/discrete_log)

  使底数的幂模某个数后等于给定值的指数。
- [divisor_count](https://zh.hilberon.com/library/divisor_count)

  一个整数有多少个正约数。
- [divisor_sigma](https://zh.hilberon.com/library/divisor_sigma)

  一个整数的各约数的幂之和。
- [divisor_sum](https://zh.hilberon.com/library/divisor_sum)

  一个整数的各正约数之和。
- [euler_e](https://zh.hilberon.com/library/euler_e)

  第 n 个欧拉数。
- [extended_gcd](https://zh.hilberon.com/library/extended_gcd)

  两个整数的最大公因数，以及得到它的乘数。
- [factor_integer](https://zh.hilberon.com/library/factor_integer)

  整数的质因数分解，以质数和指数成对的列表给出。
- [from_continued_fraction](https://zh.hilberon.com/library/from_continued_fraction)

  连分数所表示的数。
- [harmonic_number](https://zh.hilberon.com/library/harmonic_number)

  第 n 个调和数：1 + 1/2 + ... + 1/n。
- [integer_exponent](https://zh.hilberon.com/library/integer_exponent)

  某个素数在一个整数中的指数。
- [integer_partitions](https://zh.hilberon.com/library/integer_partitions)

  把一个整数写成正整数之和的所有方式。
- [is_coprime](https://zh.hilberon.com/library/is_coprime)

  检验两个整数是否没有大于 1 的公约数。
- [is_prime_power](https://zh.hilberon.com/library/is_prime_power)

  检验一个整数是否为素数的幂。
- [is_square_free](https://zh.hilberon.com/library/is_square_free)

  检验是否没有大于 1 的平方数整除一个整数。
- [jacobi_symbol](https://zh.hilberon.com/library/jacobi_symbol)

  Jacobi 符号 (a/n)，其中 n 为奇正数。
- [lucas_l](https://zh.hilberon.com/library/lucas_l)

  第 n 个卢卡斯数。
- [moebius_mu](https://zh.hilberon.com/library/moebius_mu)

  莫比乌斯函数：若某个平方数整除 n 则为 0，否则根据其质因数个数的奇偶性为 1 或 -1。
- [multinomial](https://zh.hilberon.com/library/multinomial)

  多项式系数：把 n 个物品分成给定大小的各组的方法数。
- [multiplicative_order](https://zh.hilberon.com/library/multiplicative_order)

  一个数模另一个数等于 1 的最小幂次。
- [partitions_p](https://zh.hilberon.com/library/partitions_p)

  把一个正整数写成若干正整数之和（项的次序不限）的方法数。
- [partitions_q](https://zh.hilberon.com/library/partitions_q)

  把一个正整数写成若干互不相同的正整数之和的方法数。
- [previous_prime](https://zh.hilberon.com/library/previous_prime)

  小于某个数的最大质数。
- [prime_nu](https://zh.hilberon.com/library/prime_nu)

  能整除一个整数的不同质数的个数。
- [prime_omega](https://zh.hilberon.com/library/prime_omega)

  能整除一个整数的质数个数，按重数计。
- [primitive_root](https://zh.hilberon.com/library/primitive_root)

  质数的原根：其幂覆盖所有非零剩余的数。
- [solve_congruence](https://zh.hilberon.com/library/solve_congruence)

  对变量求解同余式。
- [squares_r](https://zh.hilberon.com/library/squares_r)

  一个整数表示为给定个数平方和的方案数，计入顺序和符号。
- [stirling_s1](https://zh.hilberon.com/library/stirling_s1)

  带符号的第一类 Stirling 数。
- [stirling_s2](https://zh.hilberon.com/library/stirling_s2)

  第二类 Stirling 数：把 n 个元素分成 k 组的方案数。
- [subfactorial](https://zh.hilberon.com/library/subfactorial)

  错排数：重排 n 个元素使无一留在原位的方案数。
- [totient](https://zh.hilberon.com/library/totient)

  欧拉函数：不超过 n 且与 n 互素的整数有多少个。

## 此类别中的其他函数

这些函数还没有说明，每个只列出它的第一种写法。

- [ehrhart_count](https://zh.hilberon.com/library/ehrhart_count)
- [ehrhart_data](https://zh.hilberon.com/library/ehrhart_data)
- [integer_length](https://zh.hilberon.com/library/integer_length)
- [is_ehrhart_certificate](https://zh.hilberon.com/library/is_ehrhart_certificate)
- [lattice_reduce](https://zh.hilberon.com/library/lattice_reduce)
- [powers_representations](https://zh.hilberon.com/library/powers_representations)

## 其他类别

- [抽象代数](https://zh.hilberon.com/library/category/abstract-algebra) 55
- [代数](https://zh.hilberon.com/library/category/algebra) 52
- [假设](https://zh.hilberon.com/library/category/assumptions) 10
- [微积分](https://zh.hilberon.com/library/category/calculus) 21
- [微分方程与差分方程](https://zh.hilberon.com/library/category/differential-and-difference-equations) 187
- [初等函数](https://zh.hilberon.com/library/category/elementary-functions) 34
- [方程求解](https://zh.hilberon.com/library/category/equation-solving) 15
- [线性代数](https://zh.hilberon.com/library/category/linear-algebra) 44
- [列表](https://zh.hilberon.com/library/category/lists) 52
- [逻辑与比较](https://zh.hilberon.com/library/category/logic-and-comparison) 45
- [数值计算](https://zh.hilberon.com/library/category/numerical-computation) 5
- [优化](https://zh.hilberon.com/library/category/optimization) 6
- [展示](https://zh.hilberon.com/library/category/presentation) 7
- [概率与随机过程](https://zh.hilberon.com/library/category/probability-and-stochastic-processes) 73
- [编程](https://zh.hilberon.com/library/category/programming) 43
- [级数与求和](https://zh.hilberon.com/library/category/series-and-sums) 17
- [特殊函数](https://zh.hilberon.com/library/category/special-functions) 95
- [字符串](https://zh.hilberon.com/library/category/strings) 4
- [变换](https://zh.hilberon.com/library/category/transforms) 15
- [三角学](https://zh.hilberon.com/library/category/trigonometry) 28

---
Source: https://zh.hilberon.com/library/category/number-theory
