Digits of Pi and e
LookupsEverything runs locally in your browser — nothing is uploaded
Three ways to look, matching three real needs: The first N digits — the most common request by far (“the first 100 digits of pi”, a staple of interview preparation). A stretch starting at digit N — for example digits 1000 to 1050. Finding a digit string — “where does my birthday, 19900307, appear in pi?” This is what most people come here to play with. Within any ten thousand digits a given four-digit string appears about once on average, while a seven-digit one needs roughly ten million positions — so short strings are almost always found and long ones are a matter of luck, and the tool says plainly which it was. Only the fractional part is counted. “Digit 1” means the first digit after the point, not the leading 3. That is the universal convention for pi digits (someone who has memorised “the hundredth digit” means the fractional one), and counting the integer part would put every published reference off by one. The built-in 10,000 digits of pi and 5,000 of e were cross-checked with four unrelated identities, and the first fifty digits against published values — the provenance is documented in the data file, so this constant does not need to be taken on trust.
Features
- 10,000 decimal digits of pi and 5,000 of e built in
- Three modes: first N digits, a stretch from digit N, and searching for a string
- Search reports every occurrence, overlapping ones included, with the total count
- Digit numbering covers the fractional part only, matching the usual convention
- The data was cross-checked with four independent identities; the first 50 digits match published values
- Search accepts spaces and commas in the input
- Asking for more digits than are stored says exactly how many there are
- Everything runs on your machine with no requests
How to use
- Choose the constant: pi or e
- Choose the mode: first N digits, from digit N, or search for a string
- Fill in the digit count or the string to find
- Click Copy to take the result
FAQ
- Why stop at ten thousand digits?
- Because beyond that the storage approach would have to change. Ten thousand digits is 10 KB of text, effectively free to load with the page; whereas “show me digit 50000” cannot be served from built-in data — it would mean either shipping hundreds of kilobytes of constants or computing on the fly with a spigot algorithm (a few hundred milliseconds per request). Both serve a very small set of cases, and the current trade-off is “opens instantly, zero delay”. More digits would be a separate decision.
- Does the search miss overlapping occurrences?
- No — overlapping matches count. Searching for `11` in `111` finds it at position 1 and at position 2, and both are reported. A non-overlapping search would miss half of them, and since people use the positions to verify by hand, a missing hit looks like the string is not there. When there are many hits (searching for a single digit, say) the first 20 are listed and the rest are counted.
- Can the built-in digits be trusted?
- Yes, and you do not have to take that on faith. The data was computed with Machin’s formula and then recomputed with three entirely different identities (Euler’s arctangent formula, another Euler-style identity, and Störmer’s formula), agreeing digit for digit across all ten thousand; e was recomputed as an exact rational sum (common denominator 4000!) and matched term for term. The first fifty digits of both were also checked against published values. `constant-digits.spec.ts` compares the first hundred digits against known ones, so any future edit that slips a digit turns the suite red.
Related tools
Monte Carlo Pi
GeneratorsScatter random points in a square and estimate pi from the fraction inside the circle, with convergence listed by powers of ten.
Number Base Converter
ConvertConvert numbers between binary, octal, decimal, hex, base 36 and base 64, with long IDs converted digit for digit. Runs in your browser.
Random Number Generator
GeneratorsGenerate random integers or decimals with a chosen range, count and decimal places, plus deduplication, sorting and binary, octal or hex output.
Periodic Table
LookupsLook up any element's atomic number, names, atomic weight, category, period, group and electron configuration — or list a whole period or category at once.
Paper Sizes
LookupsA4 and A5 sizes in pixels at 72, 150 and 300 DPI, plus the full ISO A, B and C chart and North American paper sizes in mm, cm and inches.
Zodiac Lookup
LookupsLook up the Chinese zodiac animal and stem-branch for any year, or find years for a given animal, with a note on the lunar new year boundary.