Documentation contents

Script File

number_theory.at

Source
atlas-scripts/number_theory.at (153 lines)
Definitions
24
Loads
Loaded by
none of the other all.at files

Definitions in source order

primes

L5primes : inf_list
finally prefix the unique even prime
L18

factorization

L20factorization (int n) = [int,int]
(prime,exponent)

easy_factors

L33easy_factors (int n, int limit) = ([int,int],int)
find prime factors up to |limit| and quotient that might be 1 or composite
(factors,quotient)

prime_divisors

L45prime_divisors (int n) = [int]

divisors

L49divisors (int n) = [int]
all divisors, unsorted but in order compatible with divisibility relation

invertibles_modulo

L56invertibles_modulo (int n) = [int]

phi

L60phi (int n) = int
Euler totient function

gcd_Bezout_coef

L63gcd_Bezout_coef (int !a, int !b) = (int,int)
(d,s) such that d=s*a mod b

Bezout

L70Bezout ((int,int) (a,b):pair) = (int,int,int)
(d,s,t) with d=s*a+t*b)

inverse_mod

L74inverse_mod ((int,int) pair) = int

power_mod

L81power_mod (int x, int k, int n) = int

test_Fermat

L94test_Fermat (int x, int p) = bool

prime_candidats_after

L96prime_candidats_after (int n, [int] sieve_primes) = [int]

search_probable_prime

L107search_probable_prime ([int] sieve_primes, [int] Fermat_bases) = (int->int)

phi_data type

L117
set_type phi_data = (int n, int phi_n, [int] prime_factors_phi)

Fields: n, phi_n, prime_factors_phi

phi_data_of

L119phi_data_of (int n) = phi_data

prime_phi_data

L122prime_phi_data (int p) = phi_data

is_multiplicative_generator 2 overloads

L124is_multiplicative_generator (int i, phi_data(n,phi,factors)) = bool
L127is_multiplicative_generator (int i, int n) = bool

search_probable_generator 2 overloads

L130search_probable_generator (phi_data d) = int
L136search_probable_generator (int n) = int

expand

L141expand (int_poly(X,a,), int k) = int_poly
substitute X^k for X

cyclotomic_polynomial

L144cyclotomic_polynomial (int n) = int_poly

is_prime

L153is_prime(int n) = bool

Generated from atlas-scripts at commit 7e1b958 (2026-09-17).