This was a frustrating entry! I wrote a reasonable entry for Part 1, it wasn’t very well organized or optimized but it worked okay.
Here’s the program on dusa.rocks
For part 2, I thought I had a pretty good Dusa solution for Part 2. One of the key parts of the solution is detecting when you’ve gotten into a loop, and using that to compute where you’ll be on step one billion. All the logic except for modding-one-billion-minus-a-bit-by-the-cycle-length ended up in Dusa, and while one part was very very cut-paste verbose, I think I could have improved that with a bit of thought.