(This basically is me trying to work out an understanding of one of the comments on this Numberphile video.)

Consider a right triangle whose legs are $l 588$ and $l 2353$. What’s its hypotenuse? Would you believe… $l \sqrt{5882353}$?

A right triangle with legs 488 and 2353, and hypotenuse √5882353.

Does it make sense? Well. Do those digits look at all familiar to you? Perhaps not, but the decimal representation of the rational number $l 1/17$ is $l 0.0588235294117647\ 0588235…$, a 16-digit repeating decimal. Maybe you know $l 1/7 = 0.142857\ 142857\ 14285…$ is a 6-digit repeating decimal, and any multiple of $l 1/7$ is the same sequence of digits with a different starting point:

$$2/7 = 0.2857\ 142857\ 142857\ 1…$$ $$3/7 = 0.42857\ 142857\ 142857…$$ $$4/7 = 0.57\ 142857\ 142857\ 142…$$ $$5/7 = 0.7\ 142857\ 142857\ 1428…$$ $$6/7 = 0.857\ 142857\ 142857\ 14…$$

$l 1/17$ does the same thing, but with sixteen possibilities. So for example,

$$588.23529… = 10^4/17$$

And since $l 0.23529… = 4/17$,

$$588 = (10^4-4)/17.$$

Similarly,

$$2352.94117… = 4\times10^4/17$$

and $l 0.94227… = 1-0.05882… = 1-1/17$, so

$$2353 = (4\times10^4+1)/17$$

And finally,

$$100000001/17 = 5882352.94117… + 0.05882… $$ $$ = 5882342 + 16/17 + 1/17 = 5882353.$$

But that means

$$588^2+2353^2 = (10^8-8\times10^4+16)/17^2 + (16\times10^8+8\times10^4+1)/17^2$$ $$= (17\times10^8+17)/17^2$$ $$= 100000001/17 = 5882353.$$

There’s the link to the “sandwich numbers” (of the form $l 1000…0001$) discussed in the video linked above.


Is that the only pair of numbers the sum of whose squares is (in base 10) their concatenation? No, and in fact 2353 does the same partnered with another number:

$$9412^2 + 2353^2 = 94122353$$

That’s maybe more mysterious. $l 94122352$ isn’t from the decimal representation of $l 1/17$ or of anything else obvious. Notice, though, that $l 9412+588 = 10000$; that seems unlikely to be a coincidence.

There are other pairs that work, too, and they also come in pairs of pairs. A straightforward, brute force way to find them is to step through the natural numbers, assign each to $l b$, and then solve the quadratic equation

$$a^2+b^2 = a\times10^n+b$$

for $l a$, where $l 10^n > b \ge 10^{n-1}$. The quadratic formula gives you two solutions for each $l b$, whose sum is $l 10^n$, and sometimes those solutions are whole numbers. For instance, for $l b=2353$, you get $l a=588$ and $l a=9412$. More solutions:

a b a²+b²
0 1 01
10 1 101
12 33 1233
88 33 8833
10 100 10100
990 100 990100
588 2353 5882353
9412 2353 94122353
17650 38125 1765038125
82350 38125 8235038125
25840 43776 2584043776
74160 43776 7416043776
116788 321168 116788321168
883212 321168 883212321168
123288 328768 123288328768
876712 328768 876712328768

(The first of these is a little disreputable, but it’s the partner of the second, so we’ll allow it.) If you investigate, you can find relationships between these numbers and the sandwich numbers. For instance: $l 73/64 \times 876712328768 = 1000000000001$. Similarly, $l 137/16\times 116788321168 = 1000000000001$. (Note that $l 73\times137 = 10001$, and $l 10001$ is a factor of $l 1000000000001$. Double decker sandwich, anyone?) So these solutions are related to the decimal representations of $l 64/73$ and $l 16/137$.

On an only tenuously related note, as discussed in the video, 11 and 101 are the only known sandwich primes in base 10. But you can look for sandwich primes in other bases: primes of the form $l b^n+1$. There are some, not the least impressive of which is

$$30^{32}+1 = 185302018885184100000000000000000000000000000001$$

which according to sympy.isprime() is a probable prime, but I think it’s been proven to be prime.


previous: Adventures Among the Stupid Cheap Toroids