February 19th, 2021

клавиатура

Math fun

Paul Dirac has found a method to represent any natural number using only 3 twos and mathematical operations: Where number of square roots is the desired N.

Small experiment confirming this in python up to 51:

In [1]: import math

In [2]: def rsqrt(i):
...: if i<=1:
...:     return math.sqrt(2)
...: return math.sqrt(rsqrt(i-1))
...:

In [3]: def dirac(n):
...: return int(-math.log(math.log(rsqrt(n), 2), 2))
...:

In [4]: dirac(2)
Out[4]: 2

In [5]: dirac(12)
Out[5]: 12

In [6]: dirac(37)
Out[6]: 37

In [7]: dirac(51)
Out[7]: 51



Wait, but why?
For fun!