A - Squares, Lists and Digital Sums  

 

Wherever there is a number, there is beauty.

Proclo

The Problem

The list

            81, 100, 121, 144, 169, 196, 225

consists of seven consecutive squares (from the square of 9 to 15). It has a curious feature: the sum of the decimal digits of each of these numbers is itself a square. For example, 1 + 6 + 9 = 16 = 42.

Find the next sequence of seven consecutive squares with the same property.

The Input

There is no input.

The Output

The output consists of seven lines. The first line contains two numbers,which are the first of the seven numbers we are looking for and its square. The second line contains two numbers,which are the second of the seven numbers we are looking for and its square. And so on.

For example, if we had asked you for the first sequence of seven numbers that meet the property, the output would have been as follows:

9 81
10 100
11 121
12 144
13 169
14 196
15 225

OMP'16
Facultad de Informática
Universidad de Murcia