This is a problem I’ve worked on on and off since January. It was all inspired by this tweet:

16 and 9 are each square numbers, and putting them together, 169, gives another square. Other examples?

— James Tanton (@jamestanton) January 20, 2013

My math teacher from the fall semester, Math Jesus (Brendan Sullivan), retweeted it and I saw it on his Facebook page. I couldn’t think of any other examples right away, so I wrote a script to do it for me.

49. I should have though of that. Looks like there are a lot of perfect square concatenation solutions.

Next, I began to wonder if there are any perfect cubes that can be concatenated into another perfect cube. “27” + “8” = “278”, for example, if 278 were a perfect cube. But it’s not. Time to write a new script. Instead of changing the “2”s into “3”s, I generalized the code for arbitrary powers.

No perfect cube concatenation solutions?! This problem just got a lot more interesting. Based on my crude exploratory results, there are lots and lots of pairs of perfect squares that concatenate into another perfect square, but there aren’t any such perfect cubes! This problem is interesting enough that it needs a formal definition.

\(\text{Let }k\in\mathbb{N}\text{ be a power, and let }x,y\in\mathbb{N}\text{ be two numbers.}\)

\(\text{Define the set }K\text{ as the set of all perfect }k\text{th powers.}\)

\(\text{We say that }(x, y)\text{ satisfies property }P_k\text{ if and only if }\{x, y, concat(x,y)\}\subseteq K\text{.}\)

That is, property P is satisfied by two numbers x and y, for a power k, if x and y are perfect powers of k, and

int(str(x)+str(y))

is also a perfect power of k. For the example of the tweet, k is 2, and x and y are 16 and 9.

So far, our definition of the problem relies on Python and strings. That’s not really mathematically rigorous. Instead of concatenating 16 and 9 as “16”+”9″, we can calculate it as 16*10+9. More generally,

\(\forall\text{ } x,y\in\mathbb{N}. \text{ }concat(x,y) = (10^{\lfloor log_{10}y^k\rfloor + 1})x + y\)Where are all those logs and 10s coming from? Let’s look at the example of 16*10+9. To concatenate 16 and 9, we need to put 1 zero on the end of 16 to turn it into 160 before we add the terms. We need 1 zero because “9” is 1 digit long. To add n zeroes, we need to multiply by 10^n. To concatenate 16 and 99, we would need to add two zeroes to 16, by multiplying by 100. In Python, this is:

concat = lambda x, y: x*10**(len(str(y))) + y

Still, we’re relying on the length of a string representation to find the number of digits. A better way is to use logarithms. If a number if at least 100 and less than 1000, it is greater than 10^2 and less than 10^3, and it has three digits. More generally, a number x with n digits is greater than or equal to 10^(n-1), and less than 10^n. If we take the logarithm of both sides, that means log(x) is greater than or equal to (n-1) and less than n. So, floor(log(x)) = n-1. Now we have:

number_of_digits = lambda x: int(math.floor(log(x, 10))) + 1 concat = lambda x, y: x*10**(number_of_digits(y)) + y

I don’t like the 10s. The fact that we use a decimal system is arbitrary. If my conjecture, that powers of 2 concatenate but powers of 3 don’t, is true, I want to know if this is because of a property of powers of 2 and 3, or a property of adding powers of 10. To examine this problem, we need one more dimension of generalization: arbitrary bases.

Here is the final definition of the property P:

\(\text{Let }k\in\mathbb{N}\text{ be a power, let }b\in\mathbb{N}-\{1\}\text{ be a base, and let }x,y\in\mathbb{N}\text{ be two numbers.}\)

\(\text{Define }K_k=\{x\in\mathbb{N}. \exists n\in\mathbb{Z}. n^k=x\}\text{, the set of perfect }k\text{th powers.}\)

\(\text{Define the concatenation function }C_b\text{ as }\forall x,y\in\mathbb{N}.C_b(x,y)=(b^{\lfloor log_{b}y^k\rfloor + 1})x + y\)

\(\text{We say that }(x, y)\text{ satisfies property }P_{k,b}\text{ if and only if }\{x, y, C_b(x,y)\}\subseteq K_k\text{.}\)

For arbitrary k and b, we want to know if there are any pairs (x,y) that satisfy property P, and if there are any, how many. Let us define this problem as:

\(\forall k,b\in \mathbb{N}-\{1\}. \rho(k,b) = \mid\{x,y\in\mathbb{N}. P_{k,b}(x,y)\text{ holds}\}\mid\) \(\text{I conjecture that }\rho(2, 10) = |N|\text{ and that }\rho(3, 10) = 0\)To look for patterns and further insights that could help with a proof, I wrote a Python script that calculates Rho for a finite subset of the natural numbers:

rhos = [rho(x, 10, 250) for x in xrange(2, 10)] rhos

[62, 0, 0, 0, 0, 0, 0, 0]

It looks like, in base 10 anyway, power concatenation only works with k=2.

I will update later with ways to prove this, and connections to Fermat’s Last Theorem.