factorial
n! -- the product of every whole number from 1 to n.
n(number) -- a non-negative whole number
n! -- the product of every whole number from 1 to n.
n (number) -- a non-negative whole numberThe number of ways to choose r items from n, order not mattering (n choose r).
n (number) -- total itemsr (number) -- items chosenThe number of ways to arrange r items from n, order mattering (n permute r).
n (number) -- total itemsr (number) -- items arrangedThe nth Catalan number -- counts things like balanced bracket sequences and binary tree shapes.
n (number) -- index, starting at 0The nth Fibonacci number (0, 1, 1, 2, 3, 5, 8, ...).
n (number) -- a non-negative index; fibonacci(0) = 0The greatest common divisor of a and b. Works at any size (past 10^38 through big integers).
a (number) -- b (number) -- The least common multiple of a and b. Works at any size (past 10^38 through big integers).
a (number) -- b (number) -- True if a evenly divides b (b is a multiple of a).
a (number) -- the divisorb (number) -- the number being dividedThe quotient q of the division algorithm a = b*q + r with 0 <= r < |b|, exact at any size. For a positive b it is floor(a/b); quotient(-17, 5) is -4 and quotient(17, -5) is -3.
a (integer) -- b (integer) -- not 0The remainder r of the division algorithm a = b*q + r with 0 <= r < |b|: never negative, exact at any size. The same as a % b when b is positive; remainder(-17, 5) is 3 and remainder(17, -5) is 2 (17 % -5 is -3).
a (integer) -- b (integer) -- not 0Quotient and remainder together, as {quotient, remainder}, from the division algorithm a = b*q + r with 0 <= r < |b|. Read them with r.quotient and r.remainder.
a (integer) -- b (integer) -- not 0The sum of all positive divisors of n, including 1 and n itself.
n (number) -- How many positive divisors n has, including 1 and n itself.
n (number) -- (a * b) mod m, after first reducing a and b modulo m so their full product is never formed. Works at any size (past 10^38 through big integers).
a (number) -- b (number) -- m (number) -- the modulusbase^exp mod m, computed efficiently (fast exponentiation) without ever forming the full power. Works at any size (past 10^38 through big integers).
base (number) -- exp (number) -- m (number) -- the modulusThe modular inverse of a mod m -- the value x where (a*x) mod m == 1. Returns explanatory text ('no inverse exists') when a and m share a common factor.
a (number) -- m (number) -- the modulusFinds one solution to the linear congruence a*x = b (mod m). Returns explanatory text ('no solution exists') when none exists.
a (number) -- b (number) -- m (number) -- the modulusChecks whether a^(p-1) = 1 (mod p). A false result proves p is composite; a true result does not prove p is prime.
a (number) -- the base to test withp (number) -- the candidate primeTrue if n is a prime number. Works at any size (past 10^38 through big integers).
n (number) -- The smallest prime strictly greater than n. Works at any size (past 10^38 through big integers).
n (number) -- The nth triangular number, 1 + 2 + ... + n. Works at any size (past 10^38 through big integers).
n (number) -- True if n is a triangular number (1, 3, 6, 10, 15, ...).
n (number) -- pi(n) -- the count of primes less than or equal to n, computed by direct trial (simple, fine for small n).
n (number) -- pi(n) -- the count of primes less than or equal to n, computed via a sieve (fast for larger n).
n (number) -- The nth prime number (nthPrime(1) = 2, nthPrime(2) = 3, ...).
n (number) -- 1-indexed positionTrue if no prime's square divides n -- n has no repeated prime factor.
n (number) -- True if positive integer n can be written as m^k for integers m and k >= 2 (e.g. 8 = 2^3, 9 = 3^2).
n (number) -- x, y and gcd(a, b) with a*x + b*y = gcd(a, b) (extended Euclidean algorithm).
a (integer) -- b (integer) -- All twin prime pairs (p, p + 2) up to n.
n (integer) -- All cousin prime pairs (p, p + 4), both prime, up to n.
n (integer) -- All sexy prime pairs (p, p + 6), both prime, up to n.
n (integer) -- All pairs (p, p + d) with both prime, up to n.
d (integer) -- n (integer) -- Consecutive primes exactly gap apart, up to n (prime gaps).
gap (integer) -- n (integer) -- The largest gap between consecutive primes up to n.
n (integer) -- True if 2^p - 1 is prime (Lucas-Lehmer).
p (integer) -- The smallest prime with the given number of digits (10^(d-1) rounded up to a prime).
digits (integer) -- The number of decimal digits of a whole number of any size.
n (integer) -- A whole number written in base 2 to 36, as text.
n (integer) -- base (integer) -- 2 to 36The number a base-2..36 string spells.
text (string) -- quoted, e.g. "ff"base (integer) -- 2 to 36A whole number in hexadecimal.
n (integer) -- The number a hexadecimal string spells.
text (string) -- quoted, e.g. "ff"