MoreRSS

site iconJohn D. CookModify

I have decades of consulting experience helping companies solve complex problems involving applied math, statistics, and data privacy.
Please copy the RSS to your reader, or quickly subscribe to:

Inoreader Feedly Follow Feedbin Local Reader

Rss preview of Blog of John D. Cook

What is the Generalized Riemann Hypothesis?

2026-11-21 11:35:05

There were two proofs of the Riemann Hypothesis (RH) announced today: one AI-generated and one human-generated.Both claimed to prove something more general, the Generalized Riemann Hypothesis (GRH) which of course includes RH as a special case.

The RH says that the all the zero of the Riemann zeta function ζ(s) in the critical strip, i.e. the region of the complex plane where s has real part between 0 and 1, occur on the central line Re(s) = ½.

There is a ladder of conjectures of that replace ζ(s) with ever more general families of functions, always with the same conclusion, that all the zeros in the critical strip lie on the central line.

The bottom rung of the latter is the Riemann Hypothesis with ζ(s). The next rung up is the Generalized Riemann Hypothesis for the class of functions L(s, χ). The higher rungs are more abstract than I care to get into.

The Riemann zeta function is defined to be analytic continuation of the function

\zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}

The expression above is only valid for s with real part greater than 1, but the function can be uniquely extended to the entire complex plane, except for the point s = 1, by analytic continuation.

The functions L(s, χ) replace the numerator in the sum above with a function χ(n).

L(s, \chi) = \sum_{n=1}^\infty \frac{\chi(n)}{n^s}

Again this function is defined by the series above where the series converges and extended by analytic continuation to the rest of the complex plane. The remaining work is to describe the class of functions the χ belong to. Importantly this class of functions includes the constant function χ(n) = 1, which corresponds to ζ(s).

The functions χ(n) are called Dirichlet characters of modulus m, for positive integer m, which means χ: ℤ → ℂ satisfies

  1. χ(ab) = χ(a) χ(b)
  2. χ(a) = 0 iff gcd(a, m) > 1
  3. χ has period m.

For example, χ could be a Legendre or Jacobi symbol with n on top and m on bottom. For the Legendre symbol m must be an odd prime, and for the Jacobi symbol m is only required to be an odd number.

The post What is the Generalized Riemann Hypothesis? first appeared on John D. Cook.

Supersequences and Superpermutations

2026-11-19 08:10:21

A word is universal if it contains every permutation of its alphabet as a subsequence: the letters must appear in order, but gaps are allowed.

For example, you can find all six permutations of the digits 1, 2, and 3 inside the string 1231213. Not all permutations can be found as a contiguous substring—that would be a superpermutation—but all can be found as a subsequence.

The word

01234567890123456780293451670823451960782134506978231405678213904567823109456782301

is universal for the set of 10 digits. This word was discovered some time ago, but Jason Davies has recently proved that this the smallest universal word on 10 digits. It has 83 characters, and Davies proved that no word of 82 characters is universal over the digits. See his paper here.

I’m surprised that all 10! = 3,628,800 permutations of 10 digits can be found as subsequences of such a relatively short word.

Universal words, or supersequences, are easily confused with superpermutations. See OEIS sequences A062714 and A180632. Minimal length superpermutations are necessarily longer than minimal length supersequences [1] since the requirements on the former are stricter, requiring permutations to appear as contiguous substrings and not merely as subsequences. In other words, every superpermutation is a supersequence, but not vice versa.

For example,

123412314231243121342132413214321

is a minimal superpermutation on four symbols while

123412314213

is a minimal supersequence.

Note that it’s trivial to produce a supersequence: just concatenate all n! permutations of the symbols into one sequence. But finding minimal supersequences and minimal superpermutations is challenging.

 

[1] For n = 1 or 2 the minimal supersequence and minimal superpermutation are the same. For n > 2 they are not.

The post Supersequences and Superpermutations first appeared on John D. Cook.

Taxis and hash functions

2026-11-16 22:46:36

In 2014 New York City released dump of trip and fare logs from NYC taxis in the previous year. In an attempt to protect privacy, the taxi license numbers and medallion numbers were hashed using the MD5 hash function.

If you’re familiar with secure has functions, your first reaction might be that the problem with the scenario above is that NYC used a hash function that had been shown to be broken a decade earlier. But that was not the problem.

MD5 was considered broken in 2004 because someone showed how to create a hash collision, not because one can calculate a preimage. It’s easy to create two messages that have the same MD5 hash value. However, if you have a message m with hash MD5(m) = h, it is still not practical to infer m from h in general. However, if you know that your message m comes from a fairly small set, such as the set of all NYC taxi license numbers, you can hash them all and see which one hashes to h. This would be true for a more secure hash function like SHA-256 just as much as for MD5.

The root of the problem was that the hash function was known. If the city had used a keyed hash, this would have prevented anyone from simply hashing all the license and medallion numbers. If they had chosen a random number and concatenated it to each value before hashing, this would have prevented an attacker from creating a lookup table, even using MD5. There may have been other privacy problems with the data, but this particular line of attack would have been blocked.

Related posts

The post Taxis and hash functions first appeared on John D. Cook.

Orbital footnote

2026-11-16 10:19:01

A couple days ago I wrote a post about the orbit of a new dwarf planet candidate. The article says the newly discovered object, ED138, has an orbital period of 281.1 years and is “46 times farther from the sun than Earth is.”

The earlier post showed that we can infer from Kepler’s third law that the orbit must be elliptical, and that therefore the phrase “46 times farther from the sun” is ambiguous. The post worked out the orbit of ED138 under the assumption that the object is 46 AU from the sun at its aphelion, the point in its orbit furthest from the sun.

But what if is “46 times farther from the sun” refers to the average distance from the sun? I added a footnote to the post to explore this possibility. I wanted to expand that footnote into its own post because there’s something I find interesting about it.

If the maximum distance of ED138 from the sun is 46 AU, then the orbit is an ellipse with eccentricity e =  0.072. My intuition was that if we assumed the average distance from ED138 to the sun is 46 AU it wouldn’t make much difference. But it does. In this case the eccentricity becomes e = 0.38, about five times larger.

The outer ellipse, plotted in blue, is the orbit assuming 46 AU is the maximum distance. It’s nearly circular. The blue dot is the position of the sun, near the center of the ellipse.

The inner ellipse, plotted in orange, is the orbit assuming 46 AU is the mean distance. It’s noticeably more elliptical. The orange dot is the position of the sun, further away from the center of the ellipse.

Update: Someone pointed out an error in my original post, and I updated the plot. Now I’m back to the difference between the two orbits not being so big. As always, the change in eccentricity makes more of a difference to the position of the sun in the orbit than to the shape of the orbit.

Related posts

The post Orbital footnote first appeared on John D. Cook.

The longest polynomial level set

2026-11-14 23:54:10

Let p(z) be a polynomial with leading coefficient 1, i.e. a monic polynomial. What is the maximum length of the curve

{z : |p(z)| = 1}

for each degree n?

Erdős conjectured that the maximum length was obtained by the polynomial p(z) = zn − 1. He was right, as Teng Zhang proved recently.

Examples

Here’s an example for degree five. The maximum length is obtained by p(z) = z5 − 1.

This curve has length 15.02.

Here’s the corresponding curve for p(z) = z5 − z

which has length 6.909.

In general the level set {z : |p(z)| = 1} need not be connected, in which case the length is the sum of the lengths of the components.

Here’s an example that tweaks the constant parameter of the optimal curve p(z) = z5 − 1.1.

This curve has (total) length 14.59.

Details

The length of the maximum curve for given n is the length for the polynomial p(z) = zn − 1. The only curves obtaining the maximum length are translations and rotations of this curve.

Note that for n = 1 the maximum curve is a circle and for n = 2 the curve is the lemniscate of Bernoulli. The general curve is called the Erdős lemniscate of order n, generalizing Bernoulli’s lemniscate.

The maximum length for given n is

21/nB(1/n, 1/2n)

where B is the beta function.

The Erdős lemniscates look similar to the “rose” curves r = cos(nθ), but these curves are not polynomial level sets.

Related posts

The post The longest polynomial level set first appeared on John D. Cook.

Peeking inside the bash rabbit hole

2026-11-14 21:09:57

I have much bigger issues to be concerned with than saving a few seconds of typing with obscure bash features. But precisely because I have bigger issues on my plate, it’s fun to take a moment and solve some little tangible problem.

The shell !$ saves the last part of the latest command. (Mnemonic: bang often refers to commands, such as !! to redo the previous command, and cash often refers to the last of something, such as the end of a line in a regular expression.)

This comes in handy, for example, when you copy a file to a directory and then want to cd into that directory.

cp myfile /big/long/path
cd !$

The !$ variable is fragile, however. The sequence of commands

cp myfile /big/long/path
ls
cd !$

won’t work because after running ls the variable !$ now contains “ls” rather than “/big/long/path”.

There are two ways to fix this. In the previous example you could change the last command to

cd !-2:$

This says go back two commands (!-2) and extract (:) the last argument ($).

Another possibility is

cd !cp:$

This says to pull up the most recent command that started with “cp” (!cp) and extract the last argument.

This only scratches the surface of conveniences bash offers. To learn about similar features, search on “history expansion” or “event designators.”

Because bash offers so many shortcuts, it’s hard to learn any of them from reading the manual: nothing will stick. It reminds me of when I was in Paris and had one hour to see the Louvre. I should have meandered around a room or two and been content with that. Instead, I blitzed through the museum. I wanted to “see the Louvre” but I didn’t really see anything.

The post Peeking inside the bash rabbit hole first appeared on John D. Cook.