#number-theory
2 APIs with this tag
Collatz Sequence API
The Collatz conjecture (the "3n+1" or hailstone problem) as an API, computed locally and deterministically. Give it any positive integer and the sequence endpoint returns the full hailstone path — at each step an even number is halved and an odd number is tripled and incremented (3n+1) — together with the total stopping time (the number of steps to reach 1) and the peak value the sequence climbs to. Starting from 6 the path is 6, 3, 10, 5, 16, 8, 4, 2, 1 — eight steps, peaking at 16; the notoriously long start 27 takes 111 steps and soars to a peak of 9232 before collapsing. The steps endpoint returns just the stopping time and peak altitude without the whole path, for fast bulk scans of where the big climbs and long tails are. All arithmetic runs in arbitrary-precision integers so the peak stays exact even when a small starting number balloons into the millions, and a safety cap keeps every request bounded. Starting numbers up to one hundred trillion are accepted. Everything is computed locally and deterministically, so it is instant and private. Ideal for maths-education, number-theory, recreational-mathematics and puzzle app developers, sequence-and-hailstone visualisers, and teaching material on the most famous unsolved problem in arithmetic. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 2 compute endpoints. This is the Collatz/3n+1 sequence specifically; for prime factorisation or GCD use a number-theory API.
api.oanor.com/collatz-api
Number Theory API
An integer toolkit as an API. Factorize any number into its prime factors with exponents (and a readable 2^3 × 3^2 × 5 form), with the divisor count, the divisor sum, the full list of divisors and whether the number is perfect; find the greatest common divisor and least common multiple of two numbers (and whether they are coprime); and test primality, returning the next and previous prime. Handles numbers up to a trillion. Perfect for maths education and puzzles, cryptography demos, generating test data and any time you need the building blocks of a number. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 4 endpoints. A focused integer toolkit, distinct from a general math-expression engine.
api.oanor.com/numbertheory-api