# Some remarks on *Complements*

Following *Sudipta Das* (see the *Ed Pegg's* page at
mathpuzzle.com/)
we define the *n-complement* of a number *j* as the number *k*
such that corresponding digits of *j* and *k* always add to *n*.
We want to investigate some properties of the n-complements in two special cases
for the terms *j, k*:
- the square-case, say
*j=x*^{2} and
*k=y*^{2} for some *x, y*;
- the triangular-case, say
*j=x*(x+1)/2, k=y*(y+1)/2* for some *x, y*.

Let us sketch an idea that apply to the general problem (not only to our two cases).
Forbidding initial zeros on the representation of our numbers, we assume that
*j, k* have the same numbers of digits, say *d*; then we must have:
**Main Formula: ***j+k=n*S* where
*S=111...1* is composed by *d* times the digit 1.
Of course carries could appear in the sum *j+k*, thus solutions of the new
problem could fail to solve the original one; but for the new formulation many
interesting properties will be quite immediate.
## Square-Complements

### Some trivial cases

Of course any choice of *x, y* between 0 and 3 will give rise to a solution
corresponding to a suitable *n*; thus we get trivial solutions for 10 values of
*n = x*^{2}+ y^{2}
say (choosing *x £ y* and sorting the results
with respect to *n*):
x |
0 | 0 | 1 |
2 | 1 | 2 |
3 | 1 | 2 |
3 |

y |
0 | 1 | 1 |
2 | 2 | 2 |
3 | 3 | 3 |
3 |

n |
0 | 1 | 2 |
4 | 5 | 8 |
9 | 10 | 13 |
18 |

Of course we could do the same work concerning the two-digit-cases (say: *x, y*
both between 4 and 9), but it would be a quite tedious work, and a better idea could be
to ask the computer to do that. In fact, as we will show in a moment, we would waste our
time: no two-digits solution can exist.
### A little bit of theory can save a lot of time...

Let us start from the "main formula" (in our case, say with
*j=x*^{2}, k=y^{2})
and remark that, once *d* has been fixed, we can easely find some factors of the
part *S* (the parts "thus *n*S* has the factor..." will be
explained in a moment):
- if
*d* is even, the number *S* has the factor *11*
(thus *n*S* has the factor *11*11* for *n* other than 11);
- if
*d* is a multiple of *3*, the number *S* has the factor
*3* (thus *n*S* has the factor *3*3* if *3* does not divide
*n*);
- if
*d* is a multiple of *5*, the number *S* has the factor
*271* (thus *n*S* has the factor *271*271*);
- if
*d* is a multiple of *6*, the number *S* has the factor
*7*
(thus *n*S* has the factor*7*7* if *7* does not divide
*n*);
- if
*d* is a multiple of *7*, the number *S* has the factor
*239* (thus *n*S* has the factor *239*239*);
- if
*d* is a multiple of *13*, the number *S* has the factor
*79* (thus *n*S* has the factor *79*79*);
- ....

Let us explain the special role played by the numbers *11, 3, 271, 7, 239, 79*.
In general there is no relationship between the factors of *x, y* and the factors
of *x*^{2}+ y^{2}
(consider e.g. the example
*7*^{2}+5^{2} =
74 = 2*37); however in some cases a very strong connection exists: special
factors of the sum must divide both *x, y*; so that also the square
of the factor divides the sum. This happens in particular for each one of the values
*11, 3, 271, 7, 239, 79*; of course, with respect to the representation given
in the main formula, some terms could divide *n* instead of the string of ones.