The question, of course, depends on the programming language. Fix one and then it'll make sense to play code golf. Otherwise, I can just define a language with a built-in operation that takes in an arbitrary pair and outputs the primes, so (0, op) would be the smallest. On Wed, Dec 2, 2020 at 4:30 PM Leo Broukhis <leob@mailcom.com> wrote:
Apropos https://www.youtube.com/watch?v=_gCKX6VMvmU
There are many ways to produce the sequence of primes by iterating a function, e.g. starting with f_1 = ContinuedFraction(2, 3, 5, 7, 11, 13, ,,,) = 2.3130367364335829..., (http://oeis.org/A064442) and
f_n+1 = 1/(f_n - Floor(f_n))
the sequence of Floor(f_n) will be the sequence of primes.
Or, as in the clip, starting with the average of http://oeis.org/A053669 = 2.920050977316134712..., and f_n+1 = Floor(f_n) * (f_n - Floor(f_n) + 1) will do the same.
Or the Blazys continued fraction, see http://oeis.org/A233588
The question is, which constant/function pair encodes primes in the most compact way. More precisely, given a denominator for a rational approximation, which function will correctly produce the most primes starting from the approximation of the corresponding constant?
For example, with the IEEE double (64 bit floating point) approximations of the constants, the continued fraction starts diverging at 29, the Blazys continued fraction - at 47, the 2.92... constant - at 59.
I was able to come up with the function f_n+1 = Floor(f) + 1/(f_n-Floor(f_n)); which is the delta-coded continued fraction of the sequence of primes, gives rise to f_1 = 2.7101020234300968374... and given its IEEE double approximation, starts diverging at 67.
Improvements are welcome.
Thanks, Leo _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
-- Mike Stay - metaweta@gmail.com http://math.ucr.edu/~mike https://reperiendi.wordpress.com