johndcook.com

订阅源链接共 31 篇文章

Γ(1/n)

If n is a positive integer, then rounding Γ(1/ n ) up to the nearest integer gives n . In symbols, We an illustrate this with the following Python code. >>> from scipy.special import gamma >>> from math import ceil >>> for n in range(1, 101): ... assert(ceil(gamma(1/n)) == n) You can find a full proof in [1]. I’ll give a partial proof that may be more informative than the full proof. The asymptotic expansion of the gamma function near zero is where γ is the Euler...

2026-02-05 03:42原文链接
未翻译

Polish serenity

Yesterday I ran across the following mashup by Amy Swearer of a Polish proverb and the Serenity Prayer. Lord, grant me the serenity to accept when it’s no longer my circus, the courage to control the monkeys that are still mine, and the wisdom to know the difference. The proverb is “ Nie mój cyrk, nie moje małpy ,” literally “Not my circus, not my monkeys”. The post Polish serenity first appeared on John D. Cook .

2026-02-03 12:56原文链接
已翻译

Satellites have a lot of room

I saw an animation this morning showing how the space above our planet is dangerously crowded with satellites. That motivated me to do a little back-of-the-envelope math. The vast majority of satellites are in low earth orbit (LEO), which extends from 160 to 2000 km above the earth’s surface. The radius of the earth is about 6400 km, so the volume of the LEO region is There are about 12,500 satellites in LEO, so the average volume of LEO per satellite is about 100,000,000 km³. Now this isn...

2026-02-02 19:11原文链接
已翻译

AGI, ASI, A*I – Do we have all we need to get there?

Demis: “[to get to AGI] maybe there’s one or two big innovations needed ” Sam: “everything based off what we see today is that it will happen .” Ilya: “But is the belief really that if you just 100x the scale, everything would be transformed? I don’t think that’s true. ” Dario: “If you just kind of like eyeball the rate at which these capabilities are increasing, it does make you think that we’ll get there by 2026 or 2027. ”...

2026-01-30 19:46原文链接
已翻译

Bridging secrets is hard

Cryptocurrency and privacy don’t fit together as easily as you might expect. Blockchains give you the illusion of privacy via pseudonymization: you don’t put your name on a blockchain, but you do put information on a blockchain that can be used to determine your name. Blockchain analysis can often reveal information that no one intended to share. This is true even for privacy coins like Monero and Zcash. These coins put less information directly on chain in the clear, but they still ...

2026-01-30 17:09原文链接
未翻译

Fortunes and Geometric Means

I saw a post on X recently that said Bill Gates is closer to you in wealth than he is to Elon Musk. Mind blown. For round numbers, let’s say Elon Musk’s net worth is 800 billion and Bill Gates’ net worth is 100 billion. So if your net worth is less 450 billion, the statement in the post is true. The reason the statement above is mind blowing is that in this context you naturally think on a logarithmic scale, even if you don’t know what a logarithm is. Or to put it another...

2026-01-24 16:56原文链接
未翻译

Proving you know a product

There is a way to prove that you know two numbers a and b , and their product c = ab , without revealing a , b , or c . This isn’t very exciting without more context — maybe you know that 7 × 3 = 21 — but it’s a building block of more interesting zero knowledge proofs, such as proving that a cryptocurrency transaction is valid without revealing the amount of the transaction. The proof mechanism requires an elliptic curve G and a pairing of G with itself. (More on pairings shortly.) I...

2026-01-24 16:21原文链接
未翻译

How to prove you know a discrete logarithm

In a high school math class, the solution to the equation b x = y is the logarithm of y in base b . The implicit context of the equation is the real numbers, and the solution is easy to calculate. The same problem in the context of finite groups is called the discrete logarithm problem, and it is difficult to solve for large groups. In particular, it is impractical to solve when working modulo a sufficiently large prime number or when working over a sufficiently large elliptic curve [1]. In eith...

2026-01-23 16:51原文链接
未翻译

Mills ratio and tail thickness

The Mills ratio [1] is the ratio of the CCDF to the PDF. That is, for a random variable X , the Mills ratio at x is the complementary cumulative distribution function divided by the density function. If the density function of X is f , then The Mills ratio highlights an important difference between the Student t distribution and the normal distribution. Introductory statistics classes will say things like “you can approximate a t distribution with a normal if it has more than 30 degrees of...

2026-01-21 15:27原文链接
未翻译

Sigmas and Student

I saw something yesterday saying that the Japanese bond market had experienced a six standard deviation move. This brought to mind a post I’d written eight years ago. All probability statements depend on a model. And if you’re probability model says an event had a probability six standard deviations from the mean, it’s more likely that your model is wrong than that you’ve actually seen something that rare. I expand on this idea here . How likely is it that a sample from a...

2026-01-21 13:20原文链接
未翻译

Stylometry

I was reading an article this morning that mentioned a styometric analysis of a controversial paragraph written by Roman historian Flavius Josephus. I’ve written several posts that could be called stylometry or adjacent, but I haven’t used that word. Here are some posts that touch on the statistical analysis of a text or of an author. Authorship in the Federalist Papers Using TF-IDF to pick out important words Natural language processing and unnatural text Estimating vocabulary size ...

2026-01-20 15:10原文链接
未翻译

Two cheers for ugly code

Ugly code may be very valuable, depending on why it’s ugly. I’m not saying that it’s good for code to be ugly, but that code that is already ugly may be valuable. Some of the ugliest code was started by someone who knew the problem domain well but did not know how to write maintainable code. It may implicitly contain information that is not explicitly codified anywhere else. It may contain information the original programmer isn’t even consciously aware of. It’s oft...

2026-01-19 17:56原文链接
未翻译

Prime gaps and Gapcoin

The previous post looked at tightly clustered primes. This post looks at the opposite , large gaps between primes. Riecoin is a cryptocurrency that uses finding prime clusters as its proof of work task. Gapcoin uses finding prime gaps as its proof of work task. There’s some nuance to defining prime gaps. It’s trivial to produce a gap of any size. For example, [ n ! + 2, n ! + n ] is an interval of length n − 1 that contains no primes. It is more interesting to find gaps that are larg...

2026-01-19 01:20原文链接
未翻译

Prime clusters and Riecoin

Prime clusters are sets of primes that appear as close together as is generally possible. There is one pair of consecutive prime numbers, 2 and 3, but there cannot be any more: in any larger pair of consecutive numbers, one of the pair will be even. But there are a lot of twin primes, perhaps infinitely many, and so a prime cluster of size two is a pair of primes whose difference is 2. How close together can a set of three primes be? The set {2, 3, 5} has diameter 3, i.e. the difference between ...

2026-01-18 20:23原文链接
未翻译

Efficiently testing multiple primes at once

The previous post looked at a technique for inverting multiple integers mod m at the same time, using fewer compute cycles than inverting each integer individually. This post will do something analogous for prime chains, revisiting a post from a few days ago about testing prime chains . A prime chain is a sequence of primes in which each is twice its predecessor, plus or minus 1. In a Cunningham chain of the first kind, it’s always plus, and in a Cunningham chain of the second kind, it&#82...

2026-01-16 15:52原文链接
未翻译

Tighter bounds in the prime number theorem

The most elementary form of the prime number theorem says that π( x ), the number of prime numbers less than x , is asymptotically equal to x / log( x ). That’s true, but a more accurate result says π( x ) is asymptotically equal to li( x ) where Five years ago I wrote about a result that was new at the time, giving a bound on |π( x ) − li( x )| for x > exp(2000). This morning I saw a result in a blog post by Terence Tao that says for all x ≥ 2. The result comes from this paper . The ne...

2026-01-16 15:50原文链接
未翻译

Efficiently computing multiple modular inverses at once

Suppose you have a large prime number M and you need to find the inverse of several numbers mod M . Montgomery’s trick is a way to combine the computation of the inverses to take less time than computing the inverses individually. Peter Montgomery (1947–2020) came up with this trick in 1985. We will illustrate Montgomery’s trick by inverting three numbers— a , b , and c —though the trick extends to any number of numbers. It is commonly used in cryptography . Modular inverses are much...

2026-01-14 15:06原文链接
未翻译

The middle binomial coefficient

The previous post contained an interesting observation: Is it true more generally that for large n ? Sorta, but the approximation gets better if we add a correction factor. If we square both sides of the approximation and move the factorials to one side, the question becomes whether Now the task becomes to estimate the middle coefficient in when we apply the binomial theorem to ( x + y ) 2 n . A better approximation for the middle binomial coefficient is Now the right hand side is the first term...

2026-01-12 12:41原文链接
未翻译

Combining in-shuffles and out-shuffles

A few days ago I wrote two posts about perfect shuffles. Once you’ve cut a deck of cards in half, an in-shuffle lets a card from the top half fall first, and an out-shuffle lets a card from the bottom half fall first. Suppose we have a deck of 52 cards. We said in the earlier posts that the order of an in-shuffle I is 52. That is, after 52 in-shuffles, a deck returns to its initial order. And the order of an out-shuffle O is 8. We can think of I and O as generators of subgroups of order 52...

2026-01-12 12:00原文链接
未翻译

Primecoin primality test

When I wrote about how Primecoin uses prime chains for proof of work, I left out a detail. To mine a new Primecoin block, you have to find a prime chain of specified length that starts with a number that is a multiple of the block header hash. According to the Primecoin whitepaper Another important property of proof-of-work for cryptocurrency is non-reusability. … To achieve this, the prime chain is linked to the block header hash by requiring that its origin be divisible by the block header has...

2026-01-10 16:05原文链接
未翻译
第 1 页 / 共 2 页