Every factorial approximates a power
For every n, there is a base b such that n! = b^n. The relation between n and b(n) is surprisingly close to linear.
Companies come to us for help data analysis and data privacy. Clients have included Amazon, Google, Microsoft, law firms, start-ups, and smaller businesses.
Visit johndcook.com → RSS feedOn Hacker News Jan 2010 – Sep 2026
Math & Algorithms 44Software Engineering 24Life, Learning & Writing 11Career & Management 11Science & Space 9Programming Languages 6
For every n, there is a base b such that n! = b^n. The relation between n and b(n) is surprisingly close to linear.
A family of infinite sums that evaluate to rational numbers, sometimes integers, and and effective algorithm for finding the sum.
With fat tail, I.e. power law, project times, late projects are likely to be even later,
Experts often end up where they started as beginners. If you've never seen the word valet, you might pronounce it like VAL-it. If you realize the word has a French origin, you would pronounce it val-A. But the preferred pronunciation is actually VAL-it. Beginning musicians play by ear, to the extent that they can play
Here's an interesting historical anecdote from Karl Fogel's Producing Open Source Software on the value of preparing for meetings. In his multi-volume biography of Thomas Jefferson, Jefferson and His Time, Dumas Malone tells the story of how Jefferson handled the first meeting held to decide the organization of the…
Here are ten things about numerical linear algebra that you may find surprising if you're not familiar with the field. Numerical linear algebra applies very advanced mathematics to solve problems that can be stated with high school mathematics. Practical applications often require solving enormous systems of…
A while back I wrote about learning things just-in-case or just-in-time. Some things you learn in case you need them in the future, and some things you learn as needed. How do you decide whether something is worth learning ahead of time, or whether it is best to learn if and when you need it?
A good programmer is someone who can write large programs that have a high probability of being correct.
The familiar quadratic formula can give the wrong answer in a program due to numerical precision issues. This post shows what can go wrong and how to fix it. Especially important in low-precision arithmetic.
Functions include in the standard C math library that seem unnecessary at first glance and why they are necessary.
When Mathematica seems to not to know how to simplify an expression, it may be doing the right thing, being more sophisticated than you expect.
Over the course of years, RSA implementations gradually replaced Euler's totient function with Carmichael's totient function.
The informal definition of an elliptic curve is simple. The formal definition is more involved.
In hyperbolic geometry, the sum of a the interior angles of a triangle can be any value less than π. If the sum is zero the triangle has area π.
One attempt at rationalizing astrology is to say that the gravitational effects of celestial bodies impact our bodies. To get an idea how hard the stars and planets pull on us, let's compare their gravitational attraction to that of cows at various distances. Newton's law of gravity says that the gravitational…
The eigenvectors of a circulant matrix do not depend on the matrix itself, only on the size, and the eigenvectors are columns of the FFT matrix.
There is hardly ever a good reason to invert a matrix. What do you do if you need to solve Ax = b where A is an n x n matrix? Isn't the solution A−1 b? Yes, theoretically. But that doesn't mean you need to actually find A−1. Solving the equation Ax = b is
Ramanujan came up with an approximation for factorial that resembles Stirling's famous approximation but is much more accurate. As with Stirling's approximation, the relative error in Ramanujan's approximation decreases as n gets larger. Typically these approximations are not useful for small values of n. For n = 5…
Prime powers have a kinda chaotic pattern in their bits. We bootstrap this idea into a good random number generator, recapitulating history.
Any Boolean function can be computed with Tofolli gates, and Tofolli gates are reversible, and so any Boolean function can be computed reversibly.
I called someone a plumber programmer the other day. The person I was speaking to didn't realize that "plumber programmer" is a term of great respect. The plumber is often the most experienced programmer on a team. As with literal plumbing, software plumbing connects things together. It deals with things other people…
Code that shows how floating point arithmetic can go wrong, and how C and C++ can return different results for similar code.
Generating primes using the Buenos Aires constant.
I recommend using Python for data analysis, and I recommend Wes McKinney's book Python for Data Analysis. I prefer Python to R for mathematical computing because mathematical computing doesn't exist in a vacuum; there's always other stuff to do. I find doing mathematical programming in a general-purpose language is…
Clever tricks used by medieval astronomers to tabulate sines at every degree, before calculators and before calculus.
What is the point of a public key fingerprint? What does it do that the public key itself doesn't do. This post explains.
I was buying a used book through Amazon this evening. Three resellers offered the book at essentially the same price. Here were their ratings: 94% positive out of 85,193 reviews 98% positive out of 20,785 reviews 99% positive out of 840 reviews Which reseller is likely to give the best service? Before you assume it's
I'm fascinated by the myth of the Lisp genius, the eccentric programmer who accomplishes super-human feats writing Lisp. I'm not saying that such geniuses don't exist; they do. Here I'm using "myth" in the sense of a story with archetypical characters that fuels the imagination. I'm thinking myth in the sense of…
Testing whether a number is composite as an example of a zero knowledge proof. How ZKPs are used more generally.
How the 46 kana letters map onto 80 Unicode code points and how katakana and hiragana compare.