mathx
Generated by tinox doc
Number-theory helpers on Int64: gcd/lcm, primality testing (isPrime/nextPrime), fibonacci, combinatorics (factorial/combinations/permutations), modular exponentiation (modPow), and digit utilities (digitSum/digitCount).
Number theory
import tinox.core.mathx;
class Main
{
fnc main() -> Int32
{
println("gcd(48, 18) = " + Mathx::gcd(48, 18).toString());
println("isPrime(97) = " + Mathx::isPrime(97).toString());
println("nextPrime(100) = " + Mathx::nextPrime(100).toString());
println("fibonacci(10) = " + Mathx::fibonacci(10).toString());
println("combinations(5, 2) = " + Mathx::combinations(5, 2).toString());
return 0;
}
}
class Mathx
Methods
fn gcd(a: Int64, b: Int64) → Int64
fn lcm(a: Int64, b: Int64) → Int64
fn isPrime(n: Int64) → Bool
fn nextPrime(n: Int64) → Int64
fn fibonacci(n: Int64) → Int64
fn combinations(n: Int64, k: Int64) → Int64
fn permutations(n: Int64, k: Int64) → Int64
fn factorial(n: Int64) → Int64
fn modPow(base: Int64, exp: Int64, mod: Int64) → Int64
fn digitSum(n: Int64) → Int64
fn digitCount(n: Int64) → Int64