Square my chunks and add

The idea is to transform the integer a into b and iterate.
Cut a into the number of chunks you want, square them, add those squares.
Example
a = 1023 can be transformed in b (last column) like this:
1² + 0² + 2² + 3² = 1 + 0 + 4 + 9  = 14 = b
1² + 0² + 23²     = 1 + 0 + 529    = 530 
10² + 2² + 3²     = 100 + 4 + 9    = 113 
10² + 23²         = 100 + 529      = 629 
102² + 3²         = 10404 + 9      = 10413 
1023²                              = 1046529 
Question #1
Starting with 2 and iterating, what is the shortest path ending in 1?
Here are 11 steps (left column) – can you do better?
2    –> 2² = 4
4    –> 4² = 16
16   –> 1² + 6² = 1 + 36 = 37
37   –> 37² = 1369
1369 –> 1² + 3² + 6² + 9² = 1 + 9 + 36 + 81 = 127
127  –> 12² + 7² = 144 + 49 = 193
193  –> 1² + 9² + 3² = 1 + 81 + 9 = 91
91   –> 9² + 1² = 82
82   –> 8² + 2² = 64 + 4 = 68
68   –> 6² + 8² = 36 + 64 = 100
100  –> 1² + 0² + 0² = 1
1    END
Question #2
What is the shortest path starting with 3 and ending on 1 – and, in general, what are the shortest paths for all a < 100?
Question #3
a = 1233 loops, if we want: 12² + 33² = 144 + 1089 = 1233 (this is mentionned here and there, in the OEIS)
For a < 1,000,000 what are the other 1-step looping integers like 1233 (I guess this is known), 2-steps looping, 3-steps, etc. (a few such "cycles" are visible here, in the OEIS).
____________________
Friday update by Jean-Marc Falcoz (great, thanks!-)

      2
     4
    16....1^2 + 6^2
    37....37^2
  1369....1^2 + 369^2
136162....1^2 + 36^2 + 16^2 + 2^2
  1557....1^2 + 5^2 + 5^2 + 7^2
   100....1^2 + 0^2 + 0^2
     1 

     3
     9
    81....81^2
  6561....6^2 + 56^2 + 1^2
  3173....3^2 + 1^2 + 7^2 + 3^2
    68....6^2 + 8^2
   100....1^2 + 0^2 + 0^2
     1
 
     4
    16....1^2 + 6^2
    37....37^2
  1369....1^2 + 369^2
136162....1^2 + 36^2 + 16^2 + 2^2
  1557....1^2 + 5^2 + 5^2 + 7^2
   100....1^2 + 0^2 + 0^2
     1






Commentaires

Posts les plus consultés de ce blog

A square for three (chess)

Le tripalin se présente

Underline, reproduce