Tag Archives: fun

A funny numeration system

When I swim at the pool of Antibes, I usually count the laps I do. It is just an obsession, I just feel good when I know how many laps I did.

At first I was using the regular decimal system, but after a while I found it a bit boring. So I progressively shifted to other kinds of counting methods, just to conjugate the water I was swallowing with some mathematical brain-twisting fun.

That’s how I ended up counting in other languages (German, Chinese or Swedish) and in other numeral system: Roman, binary, octal, duodecimal, hexadecimal.
Since I often try to do 40 laps, that makes me count up to vierzig, 四十, fyrtio, XL, 101000, 050, 34, x28.

But lately, I had the idea to count in a new interesting numeral system, and I would like to share it in this post. I have not found a lot of posts dealing with this kind of counting system (at least I think Kurt Gödel used it somehow) and I even do not really know if it has practical applications (let’s keep these reflexions for the conclusion). But at least it find it is quite funny to count with it.

The numeration system

The fundamental theorem of arithmetic states that every integer can be written as a unique product of prime numbers.

That’s why and .

So I thought: why cannot we use this uniqueness to write numbers? We could take primes as the base of the system and for each, we assign a number, the exponent.
In that system 240 would be written something like a list of tuples: (2,4),(3,1),(5,1). Or better, we could use a positional system where the position will be the prime number position in the list of prime numbers, and the number assigned to the position will be the exponent.
For example, the number 240 would be written 411 since 2, 3 and 5 are the 1st, 2nd and 3rd prime numbers. And for 1170, it is: 121001.

But since the exponent is itself a number, you cannot write it in base 10. So let’s write it in the same prime-number-decomposition system. I will put bracket around the position. In that system it seems you end up only needing brackets, 0 and 1…
In that system, the number becomes , and that is why the number 240 should then be written .

So let’s count from 1 to 10!

Counting to 10000

Back from the swimming pool, I was wondering: that would be great to count even higher. Let’s program a little. That’s how I ended up writing some Python script to count up to 10000 with that method.
It is not really complicated admittedly, and if we assume having a function fac(n) to get the decomposition of an integer in prime numbers, this is the program you can use to count numbers1:

num = 10000
result = {1: '0'}
primes = []
maxlength = 0
for n in range(2,num+1):
    f = fac(n)
    if len(f) == 1:
        primes.insert(0,f[0])
        s = '1'+'0'*maxlength
        maxlength += 1
    else:
        s = ''
        b = False
        for p in primes:
            c = f.count(p)
            if c==0:
                if(b):
                s += '0'
            elif c==1:
                s += '1'
                b = True
            else:
                s += ('['+result1+']')
                b = True
                result[n] = s
    print(repr(n).ljust(6),s)

The result: the complete numeration from 1 to 10000 can be found here

For the factorization in prime numbers I used the pyecm script, which uses the Elliptic curve method for the factorization. Since the script is not adapted for a version of Python higher than 3, I did adapt it a little. The complete source code is here (note that this source code is licensed under GNU GPL).

Is it useful?

My answer is NO. Don’t use it at home!
I have several reason to think this numeral system is far from being useful in everyday’s life (at least when you are not swimming laps):

  • Small number can be very long to write. For example 2012 is written 10000000000000000000000110, which is also very hard to understand!
  • To write a number, you need to know how the number before were written. And you also need to know the list of prime number by heart.
  • To write a given number you need to decompose numbers in primes, which is far from being an easy exercise!

Besides, I do not see any practical use of this notation. If it is easy to multiply and get the GCD/LCM of two numbers, there is no obvious way to divide and add them to each other…

  1. Note that I did not pay a lot of attention concerning the memory consumption of this method. Storing the list of primes and most of all the complete numeration in a dictionary is not the cleverest idea! []