[Community Puzzle] Halting sequences


#1

https://www.codingame.com/training/medium/halting-sequences

Send your feedback or ask for help here!

Created by @Waffle3z,validated by @java_coffee_cup,@Alain-Delpuch and @R2B2.
If you have any issues, feel free to ping them.


#2

Is there some kind of trick to figuring out if something will end up looping? Because I don’t get how to solve this without some brute forcing. I get that you should keep track of the answers from the previous pairs, but on the larger number sets I get stack overflow error.


#3

Yes, there is definitely a trick :slight_smile:
Some of the testcases involve huge numbers and the length of the loop can be quite large so I don’t think a simple simulation could work here. This puzzle is more math than coding.
Try to figure out what specific property a and b have if they result halt. The example in the description and the other IDE test cases help a lot!