## Sesquinary representations

All positive integers can be written in the form where and each .

This is called the *sesquinary* (for “one and a half”) representation of a positive integer.

That this is possible, and an algorithm for carrying out the representation, follows fairly directly from an application of Jim Tanton’s exploding dots machines: a machine in particular.

Here’s how we can get the sesquinary representation of 29, and get an instant feel for how a general algorithm for the sesquinary representation of any positive integer works (such is the intuitive power of exploding dots):

We begin with 29 dots placed in the right-most box in the diagram below and then successively “explode” groups of 3 to groups of 2 one box to the right:

This suggests right away a general algorithm for finding the digits in a sesquinary representation of a positive integer n:

- divide n into as many groups of 3 as possible: this is the integer part of n/3;
- remove all these groups of 3 from the box in which n resides(the right-most box to start) and place 2 times that many dots in the box to the left: this is the new n;
- the digit to be recorded is the number of dots (0, 1 or 2) left in the box in which n was originally;
- keep doing this until n is 1 or 2.

Here’s the algorithm written in *Mathematica®* code:

**SesquinaryDigits[n0_] := Module[{n = n0}, digits = {};**

** While[n >= 3, digits = Prepend[digits, 3*FractionalPart[n/3]]; **

** n = 2*IntegerPart[n/3]];**

** digits = Prepend[digits, n]]**

As an example, let’s compute a sesquinary representation for the base 10 number 157:

**SesquinaryDigits[157]**

{2, 1, 2, 0, 0, 1, 2, 2, 2, 1}

**Sesquinary palindromes**

A *palindrome* over some alphabet is a (finite) word, or string, of symbols from the alphabet that reads the same backwards as forwards.

An example of a palindrome using the Latin alphabet as symbols is MADAMIMADAM.

A positive integer n is called a *sesquinary palindrome* if its sesquinary digit list reads the same backwards as forwards.

Are there any such numbers?

Well yes: 1 and 2 rather obviously.

And 5 (base 10) because the sesquinary digit list of 5 is {2, 2}

Then 8 with sesquinary digit list {2, 1, 2}, and 17 with sesquinary digit list {2, 1, 0, 1, 2}.

We can do a search for sesquinary palindromes up to 10^7:

**n = 1;**

**L = {};**

**While[n <= 100000000, **

** If[SesquinaryDigits[n] == Reverse[SesquinaryDigits[n]], L = {L, n}; **

** Print[n]];**

** n++]**

**L = Flatten[L]**

with the result {1, 2, 5, 8, 17, 35, 170, 278, 422, 494} – that is, only 10 sesquinary palindromes up to 10^7.

Are there any more?

Is there another sesquinary palindrome lurking out there?

Is there more than one more?

Are there infinitely many?

Jim Propp @JimPropp asked on Twitter(10 Sep 2017):

Has anyone looked for “sesquinary palindromes” beyond 10^8? I’ll be blogging about the problem soon, so I’d like to know where things stand.