Page 1 of 1

Counters

Posted: September 25th, 2023, 11:17 am
by cinelli
---  ---  ---  ---  ---  ---  ---  ---  ---
|1| |2| |3| |4| |5| |6| |7| |8| |9|
--- --- --- --- --- --- --- --- ---

The diagram shows nine numbered counters 1 to 9 in order. Consider exchanging any two counters. For example swap 7 & 8. Then 8 & 4, 4 & 6, 6 & 9, 9 & 3 and 3 & 2. With these six exchanges we arrive at the number 139,854,276 which is the square of 11,826. This puzzle is to arrive at a square number in the same fashion in the least number of exchanges.

Cinelli

Re: Counters

Posted: September 25th, 2023, 2:46 pm
by UncleEbenezer

123456789

1 <==> 5

523416789

4 <==> 8

523816749

6 <==> 4

523814769

which is the square of 22887 in three swaps.

Re: Counters

Posted: September 28th, 2023, 11:45 am
by cinelli
Reply to solution.

Very well solved, UncleEbenezer. As for the method, these were my thoughts.

There are 21623 9-digit squares and when we restrict our search to those which include all nine digits, this number goes down to just 30. Likely candidates to solve the puzzle are those which already have several digits in the right positions.

157,326,849 looks a possibility and this takes 4 swaps: 7&3, 3&4, 4&8, 2&5. But 523,814,769 is the winner with just three swaps.

I wonder how this could be solved without computer aid.


Cinelli

Re: Counters

Posted: September 28th, 2023, 3:15 pm
by UncleEbenezer
It's not just digits already in the right place, it's also how much each single swap accomplishes. Most obviously, the first swap in my solution, which puts both the digits in their final places.

I suspect a bit of sudoku addiction made that one particularly easy for me as soon as I'd enumerated eligible squares. 8-)