# What are the possible place values in balanced ternary?

Balanced ternary is an alternative number base to other bases like decimal or binary. We express an integer $$n$$ as $$\Sigma_{i=0}^ka_iw_i$$ where $$a_i$$ = 0, 1 or -1 (see here). Every $$n$$ has to be expressible this way for exactly one choice of $$(a_i)$$.

Conventionally $$w_i = 3^i$$, so the place values are

$$1, 3, 9, 27, 81\dots$$

This problem is discussed in problem 73 of Essence of Mathematics through Elementary Problems by Alexandre Borovik and Tony Gardiner. (link)

My question is what other values may be possible for $$w_i$$ (the "weights"). It appears we can also use

$$2, 3, 9, 27, 81\dots$$

with 2 replacing 1. Are there any other possibilities for $$w_i$$?

Here are the numbers 1 to 27 in both bases, the standard base first and the alternative base second:

\begin{align} 1 & = 1 &=& 3 - 2 \\ 2 & = 3-1 &=& 2 \\ 3 & = 3 &=& 3 \\ 4 & = 3 +1 & = &9-3-2 \\ 5 & = 9 - 3- 1& = &3+2 \\ 6 & = 9-3& = &9-3 \\ 7 & = 9-3+1& = &9-2 \\ 8 & = 9-1& = &9-3+2 \\ 9 & = 9& = &9 \\ 10 & = 9+1& = &9+3-2 \\ 11 & = 9+3-1& = &9+2 \\ 12 & = 9+3& = &9+3 \\ 13 & = 9+3+1& = &27-9-3-2 \\ 14 & = 27 -9-3-1& = &9+3+2 \\ 15 & = 27 -9-3& = &27-9-3 \\ 16 & = 27 -9-3+1& = &27-9-2 \\ 17 & = 27 -9-1& = &27-9-3+2 \\ 18 & = 27 -9& = &27-9 \\ 19 & = 27 -9+1& = &27-9+3-2 \\ 20 & = 27 -9+3-1& = &27-9+2 \\ 21 & = 27 -9+3& = &27-9+3 \\ 22 & = 27 -9+3+1& = &27-3-2 \\ 23 & = 27 -3-1& = &27-9+3+2 \\ 24 & = 27 -3& = &27-3 \\ 25 & = 27 -3+1& = &27-2 \\ 26 & = 27 -1& = &27-3+2 \\ 27 & = 27 & = &27 \\ \end{align}

As you can see, in the standard base the numbers come in pairs that add to a power of three, with e.g. 13 pairing with 14 to make 27. In the alternative base, this pattern is nearly maintained, except the middle pairs swap around, so the expression for 13 involves 27 rather than the expression for 14 (likewise 4 swaps with 5).

## First idea - excluding possible weights

I found some ways to investigate possibilities. Suppose the two smallest weights are $$3$$ and $$4$$. Then make a list of all of the numbers you can make using the $$3$$ and $$4$$:

$$1,3, 4, 7$$

Then make a list of the sums and differences of these numbers:

$$2, 5, 6, 8, 10, 11$$

Every number on this last list must involve at least a 3 or a 4 in its expression. Otherwise, we could get a duplicate expression for one of the numbers we could make. For example, suppose we have weights $$200$$ and $$210$$ and make $$10$$ as $$210 - 200$$. Then we could use $$7 + 3 = 10$$ to get duplicate expressions for $$7$$: $$7 = 4 + 3$$ and $$7 = 210 - 200 - 3$$.

Write an equation like:

$$(1, 3, 4, 7) + X = \pm (2, 5, 6, 8, 10, 11)$$

For each of the six numbers on the right hand side, this represents four equations, exactly one of which must be true where the representation of $$X$$ does not include 3 or 4. For example:

\begin{align} 1 + X = \pm 6 \\ 3 + X = \pm 6 \\ 4 + X = \pm 6 \\ 7 + X = \pm 6 \end{align}

We have two lists of numbers that use 3 or 4 in their representation (1,3,4,7 and 2,5,6,8,10,11), and using this list you can exclude many possible solutions for X. The only possible solution is $$3 - 9 = -6$$. This shows that we must be able to make 9 without using 3 or 4.

(However, it's not clear whether we have to add 9 as a weight, or if we could make 9 using other new weights.)

In general, if $$w$$ is a weight, it has to be involved in the expression for $$2w$$, with a minus sign. (If it has a plus sign then $$2w = w + (w)$$ where the bracketed $$w$$ is some other expression for $$w$$, then we can subtract $$w$$ from both sides to get two different expressions for $$w$$.) This might show where powers of three have to appear as weights as $$2w = (3w) - w$$.

## Second idea - looking at the pattern of gaps

Another idea is to look at the list of numbers we could make with some collection of weights. For example, with $$1$$ and $$4$$ we make four numbers $$1, 3, 4, 7$$. Any new weight we add repeats the "structure" of these four numbers twice, in terms of where there are numbers and where there are gaps.

The new weight must avoid overlaps with existing possible numbers. An easy way to do this is to double the largest weight and add one. For example, if we add a weight of $$7\times2+1=15$$, then the numbers we can make are now:

$$\underline{1,3,4,7},\underline{8,11,12,14},{\bf15},\underline{16,18,19,22}$$

Notice in the second underlined group, the pattern of differences switches from "2 to 1 to 3" to "3 to 1 to 2".

However, for each missing number in the list (e.g. 2), at some point adding a new weight would have to obtain this number. Thus the pattern of possible numbers has to fit with itself when reversed like a jigsaw. For example, adding $$9$$ as a weight when the possible numbers are $$1,2,3,5$$ results in a new list of possible numbers starting

$$1,2,3,{\bf4}, 5, {\bf 6, 7, 8}$$

The list $$4, 6, 7, 8$$ complements the list $$1,2,3,5$$ perfectly and fills in the gap for $$4$$.

For the list $$1,3,4,7$$, as $$2=3-1$$ we have to use $$3$$ and $$4$$ to make $$2$$ so we are using one of the numbers $$1,3,4,7$$ to make $$2$$, and whatever transformation we do to one of those also applies to the whole list of numbers. We could add $$9$$ as a weight filling in the list up to 9: $$1,2,3,4,5,6,7,8,9,10,12,13,16$$. The pattern of gaps at the end remains the same. This could be repeated indefinitely by using more powers of three as weights, producing another possibility:

$$3,4,9,27,81\dots$$

• It seems, initially, like you can take $w_i=a_i3^i$ where $a_i\in\{1,2\}$ and infinitely many $a_i=1.$ I might be wrong. Commented Oct 24, 2021 at 21:26
• Good observation although 3,5,9,27,81... also seems to work and doesn't fit this pattern Commented Oct 27, 2021 at 3:21