← Back to context

Comment by quuxplusone

1 day ago

The Python script from TFA:

    s = 2.920050977316134
    for _ in range(16):
      i = int(s)
      print(i)
      s = i*(1 + s - i)

You might ask, "Isn't this just continued fractions?" But it's not, quite. The continued-fraction version of that script would be:

    s = 2.313036736433583
    for _ in range(16):
      i = int(s)
      print(i)
      s = 1 / (s - i)

The latter (continued-fraction) version is good for only 8 prime terms before it breaks down at the limits of IEEE double precision. The former (TFA, Buenos-Aires-constant) version is good for 13 prime terms! That is, the Buenos Aires protocol is a noticeably better "compressor" than the continued-fraction protocol, given the fixed bit-budget of IEEE double-precision floating point.

If I'm reading it right, the explanation is that whereas the continued-fraction protocol is general enough to compress any positive-integer sequence, the Buenos Aires protocol can compress only any monotonically nondecreasing positive-integer sequence where each term is between 1 and 2 times the previous term. (The sequence of primes is such a sequence.) Greater flexibility means lower efficiency, and vice versa.