https://www.johndcook.com/blog/2025/02/18/the-buenos-aires-constant/ John D. Cook Skip to content * MATH + PROBABILITY + SIGNAL PROCESSING + NUMERICAL COMPUTING + SEE ALL ... * STATS + EXPERT TESTIMONY + WEB ANALYTICS + FORECASTING + RNG TESTING + SEE ALL ... * PRIVACY + HIPAA + SAFE HARBOR + CRYPTOGRAPHY + DIFFERENTIAL PRIVACY + PRIVACY FAQ * WRITING + BLOG + RSS FEED + TWITTER + SUBSTACK + ARTICLES + TECH NOTES * ABOUT + CLIENTS + ENDORSEMENTS + TEAM + SERVICES (832) 422-8646 Contact The Buenos Aires constant Posted on 18 February 2025 by John The Buenos Aires constant is 2.92005097731613... What's so special about this number? Let's see when we use it to initialize the following Python script. s = 2.920050977316134 for _ in range(10): i = int(s) print(i) s = i*(1 + s - i) What does this print? 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 If we started with the exact Buenos Aires constant and carried out our operations exactly, the procedure above would generate all prime numbers. In actual IEEE 754 arithmetic, it breaks down around Douglas Adams' favorite number. The Buenos Aires constant is defined by the infinite sum \lambda = \frac{2-1}{1} + \frac{3-1}{2} + \frac{5-1}{3\cdot 2} + \ frac{7-1}{5\cdot 3 \cdot 2} + \cdots As you can tell, the primes are baked into the definition of l, so the series can't generate new primes. I used mpmath to calculate l to 100 decimal places: 2.920050977316134712092562917112019468002727899321426719772682533107733772127766124190178112317583742 This required carrying out the series defining l for the first 56 primes. When I carried out the iteration above also to 100 decimal places, it failed on the 55th prime. So I got about as many primes out of the computation as I put into it. Related posts * Prime numbers and Taylor's law * Quicksort and prime numbers * Prime numbers and phone numbers Reference: Beyond Pi and e: a Collection of Constants. James Grime, Kevin Knudson, Pamela Pierce, Ellen Veomett, Glen Whitney. Math Horizons, Vol. 29, No. 1 (September 2021), pp. 8-12 Categories : Math Tags : Number theory Bookmark the permalink Post navigation Previous Post1 + 2 + 3 + ... = -1/12 Next PostMultiplication tables and Latin squares 2 thoughts on "The Buenos Aires constant" 1. Sam 18 February 2025 at 17:43 If you write the loop as for _ in range(1, 11): It avoids the confusion of using i for two things. Or simpler for _ in range(10): 2. Johnathan Corgan 18 February 2025 at 19:33 This reminds me of the compression scheme where you replace text with the offset into pi that contains the ascii encoding of the text... Leave a Reply Your email address will not be published. Required fields are marked * [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment * [ ] Name * [ ] Email * [ ] Website [ ] [Post Comment] [ ] [ ] [ ] [ ] [ ] [ ] [ ] D[ ] Search for: [ ] [Search] John D. Cook John D. Cook, PhD My colleagues and I have decades of consulting experience helping companies solve complex problems involving data privacy, applied math , and statistics. Let's talk. We look forward to exploring the opportunity to help your company too. John D. Cook (c) All rights reserved. Search for: [ ] [Search] (832) 422-8646 EMAIL