Erlang C, in every language
The Erlang C call-centre staffing formula — a live calculator, the maths, and the same five functions written out in 30 programming languages. Free to copy, verified against known values.
The code for every language lives in the repo — browse or download it on GitHub.
Erlang C is the formula that staffs every contact centre with a queue: give it the offered call load and a service-level target, and it returns the number of agents you need. I’ve been writing and rewriting it for fifteen years — a command-line tool in C, a Mac app, an iPhone app, a Ruby library — so I finally put the whole thing in one place: a live calculator, the maths worked through, and the same five functions written out cleanly in thirty languages, all public domain.
One formula, thirty languages
The core is five small functions — erlangC, serviceLevel, asa, agentsRequired, and an lgamma helper. The page carries an identical, self-contained implementation of all five in each language, so you can lift whichever one matches your stack and drop it straight in. No packages, no framework, nothing to attribute.
Numerically stable by construction
Naive factorials overflow past about 170 agents — which quietly breaks a lot of Erlang C code at exactly the centre sizes that matter. Every implementation here computes the Poisson terms in log-space using a bundled Lanczos lgamma (matched to the platform’s own to about 1×10⁻¹³), so results stay exact at any size and depend on nothing but the standard maths library. Every port is checked against the same worked example: 100 calls / 30 minutes, 180-second handle time, 80% answered within 20 seconds → 14 agents.
A little history
Agner Krarup Erlang derived this at the Copenhagen Telephone Company in 1917, to size manual switchboards. More than a century later it still staffs every queue you have ever waited in.
Take it
The whole thing is CC0 — public domain. No rights reserved: copy it, port it, ship it. Corrections and new-language ports are welcome. The code and the live calculator both live on GitHub — the links are above.