Posted by: Gary Ernest Davis on: April 27, 2010

The unusual title for this post comes from a tweet from my Twitter colleague Peter

Peter tweeted that he was thinking about writing numbers in base 2.5

I recalled that some years ago when I was teaching a graduate mathematics education class at Rutgers, we looked at an algorithm for generating the expansion of a number in a given whole number base, and one of the students asked what would happen if we chose a fractional base – like .

We implemented the algorithm in Excel, so we just changed the base from a whole number – 2 – to a fractional number – – and bingo! the digits of the expansion appeared.

How do we go about writing a number such as as a sequence of digits base 2?

First we have to agree on what the digits base 2 are. The usual convention is that they are the digits 0 and 1.

So we are looking for a representation of in the form Â (base 2) where the are digits 0 or 1.

By this we mean that .

How can we find the sequence of digits ?

The key is to begin by multiplyingÂ by the base 2. Â This gives us the representation .

The digit is then the integer part – or floor – of , so and

Now we multiply by 2 again to get the repesentation .

This means that is the floor of , namely 1, and .

Now we are in luck, because we have a representation for again, so we can take and .

So the base 2 representation for is

Recall this means that

The recursive algorithm for finding the digits in the base 2 expansion of a number is so simple that we can code it in Excel (of course feel free to use Python or R).

Here’s how the Excel spreadsheet looks:

base = | 2 | n | b(n) | a(n) |

number = | 1/3 | 1 | 0 | 1/3 |

2 | 1 | 2/3 | ||

3 | 0 | 1/3 | ||

4 | 1 | 2/3 | ||

5 | 0 | 1/3 | ||

6 | 1 | 2/3 | ||

7 | 0 | 1/3 | ||

8 | 1 | 2/3 | ||

9 | 0 | 1/3 | ||

10 | 1 | 2/3 | ||

11 | 0 | 1/3 | ||

12 | 1 | 2/3 | ||

13 | 0 | 1/3 | ||

14 | 1 | 2/3 | ||

15 | 0 | 1/3 | ||

16 | 1 | 2/3 | ||

17 | 0 | 1/3 | ||

18 | 1 | 2/3 | ||

19 | 0 | 1/3 | ||

20 | 1 | 2/3 |

with the entries in the a(n) column set to be fractions (rather than decimal expansions).

The simple Excel code to generate this table is as follows:

base = | 2 | n | b(n) | a(n) |

number = | =1/3 | 1 | =INT(E2*$B$1) | =B2 |

=C2+1 | =INT(E3*$B$1) | =E2*B$1-D2 | ||

=C3+1 | =INT(E4*$B$1) | =E3*B$1-D3 | ||

=C4+1 | =INT(E5*$B$1) | =E4*B$1-D4 | ||

=C5+1 | =INT(E6*$B$1) | =E5*B$1-D5 | ||

=C6+1 | =INT(E7*$B$1) | =E6*B$1-D6 | ||

=C7+1 | =INT(E8*$B$1) | =E7*B$1-D7 | ||

=C8+1 | =INT(E9*$B$1) | =E8*B$1-D8 | ||

=C9+1 | =INT(E10*$B$1) | =E9*B$1-D9 | ||

=C10+1 | =INT(E11*$B$1) | =E10*B$1-D10 | ||

=C11+1 | =INT(E12*$B$1) | =E11*B$1-D11 | ||

=C12+1 | =INT(E13*$B$1) | =E12*B$1-D12 | ||

=C13+1 | =INT(E14*$B$1) | =E13*B$1-D13 | ||

=C14+1 | =INT(E15*$B$1) | =E14*B$1-D14 | ||

=C15+1 | =INT(E16*$B$1) | =E15*B$1-D15 | ||

=C16+1 | =INT(E17*$B$1) | =E16*B$1-D16 | ||

=C17+1 | =INT(E18*$B$1) | =E17*B$1-D17 | ||

=C18+1 | =INT(E19*$B$1) | =E18*B$1-D18 | ||

=C19+1 | =INT(E20*$B$1) | =E19*B$1-D19 | ||

=C20+1 | =INT(E21*$B$1) | =E20*B$1-D20 |

The key is to start with as the number whose base 2 representation we want to find. Then integer part (=floor) of Â (in this case the base is 2), and .

Having set up the Excel code this way we can change the number whose representation we want to find from to or even .

We can also change the base. If we change the base to 3, so using the digits in our representations, we get, for example, (base 3).

But nothing stops us from choosing a fractional base, such as .

In this case the digits will be 0, 1 or 2 Â – the non-negative integers less than.

Then, we get, for example,Â (base 2.5).

We can even choose transcendental bases such as and to within the numerical accuracy of Excel, we get (base ).

We can even calculate the base b expansion of a number where b is a complex integer – that is a complex number of the form where m and n are integers. Â This is because there is a nice floor function for complex integers, which is .

We can use the built-in complex arithmetic of Excel to carry out the calculations as before (but you might want to use Mathematica, MATLAB, R or Python instead).

Two examples are:

(base 1+i ) and repeated (base 1+i).

Because of the problem of non-uniqueness of representation in weird bases, one needs to think a little about what are appropriate digits for a base b representation, where b is something other than a positive integer, as pointed out in the comment by John Lame, below.

A lovely account of representation in weird bases appears in James Tanton’s Exploding Dots.

1 | John Lame

June 29, 2010 at 11:34 am

This seems to be the standard interpretation of fractional bases and yet the problem I have with it has always been uniqueness of representation. Admittedly, even in base 10, we have 1.0 = 0.99999…, but at least we can make the claim that every real number is represented by at most finitely many expansions in base 10 (at most 2 representations in fact).

In base 2.5 however, (i suspect) we have infinitely many representations of every real number. For instance, if I’ve done this correctly:

2.5 = 10.0… = 2.101110000110121 … = 2.02212110011122…

Even if we define exactly what we mean by “the” base 2.5 expansion of a number, I wonder if there aren’t uncountably many expansions which would end up being invalid base 2.5 representations of anything. Again, nothing proven here, just a statement of why this whole approach seems unsatisfactory.

I would find either of the two following approaches more interesting.

1.) Throw away the idea that the “digits” in base 2.5 are {0, 1, 2}. Instead, let them be {0, x_1, x_2, …, x_n} (with n probably equal to 2, but without starting with that assumption) and then come up with real values for x_1, x_2, … such that for some fixed positive integer R. every real number in [0, 1) has at least 1 and at most R representations of the form 0.ddddddd… where each ‘d’ is one of the digits, and such that every representation of the form 0.ddddddd… does converge to some real number in [0, 1). This may be easily proven to be impossible, I just haven’t tried to work it out yet.

2.) Start much more abstractly by proving as many statements about representations of real numbers in an integral base B as one can, and then define “representation of real numbers in a non-integral base B” to be a representation scheme which satisfies an “interesting” sub-collection of those statements.

John