Back

#3n-plus-1

1 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