Jump to content

Talk:Sub-unit squares

From Rosetta Code

Why all the answers except 1 end with 36

We know that all perfect squares always end in 1,4,5,6,9, or an even number of zeroes. In addition, we know that for a number that ends in 1,4,9 its tens digit will always be even (2,4,6,8,0). If it ends with 6, its tens digit will be odd (1,3,5,7,9). If it ends with 5, its tens digit will be 2.
The initial perfect square cannot end in 2, 3, 7, or 8 (see above).
The initial perfect square cannot end with 0, because then we cannot subtract 1 from that zero.
If the initial perfect square ends in 9: This can only be the initial square, since it cannot be produced by subtracting 1 from each digit. Then the subtracted result ends in 8. But then this cannot be a square. So, the initial square cannot end in 9.
If the initial perfect square ends with 5, then its tens digit must be 2. So, the result after subtracting 1 from each digit ends in 14. But if a perfect square ends in 4, its tens digit must be even, and 1 is odd. So, the initial perfect square cannot end in 5.
If the initial perfect square ends in 4, then the resulting number after subtracting 1 from each digit ends in 3. But a perfect square cannot end with a 3. So, the initial perfect square cannot end with 4
Except for 1, if the initial perfect square ends with 1, then the number after subtracting 1 from each digit ends with 0. But all perfect squares ending with 0 have a tens digit of 0. So, the initial perfect square must end with 11. But if a perfect square ends with 1, its tens digit must always be even. So, the initial square cannot end with 1.
Therefore, by elimination, the initial perfect square must end in 6.
If the perfect square ends in 6, then when we subtract 1 from each digit, the resulting number will end in 5, so that number's tens digit must be 2 if the result is a perfect square. So, the initial number must end in 36. --Wherrera (talk) 18:43, 23 September 2022 (UTC)

An alternative method

I am going to start by solving a relaxation of the task description. For a z digit number find perfect squares (g*g) ending in 5 such that (g*g)+10z/9 is also a perfect square. g will be the sequence of integers between ⌈√10z⌉ and ⌊√10z+1-1-10z/9⌋ ending in 5. For 4 digit numbers the candidates (g) are 25 35 45 55 65 75 85;

For a given g I form the next perfect square by adding 2g+1. So for g=45 I can form a series of perfect squres:

 g2+91 g2+91+93 g2+91+93+95 .....

so for 452+1111 to be a sub-unit square 91+93+95+... must equal 1111.

   91 184 279 376 475 576 679 784 891 1000 1111 ...
 n= 1      2       3       4       5         6

I leave it to the reader to verify that this is not the case for other candidates. In general the value of the nth term (z say) is (2*n - 1)*(2*n + 2*g - 1). Rearranging to find n:

    √(g2+z)  g   1
n = ------ - - + -             where z is the value needed i.e. 10number of digits/9
      2      2   2

In fact it is not necessary to solve for n merely to show that it is an integer. Because I relaxed the tasks' requirement a value of g that passes the above test should be checked for compliance. --Nigel Galloway (talk) 13:13, 27 September 2022 (UTC)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.