Being a (much) poorer mathematician than programmer, I used Monte Carlo as Allan suggested. With box (here a/k/a 3D torus) 5x13x31, a program played 10^6 games. In each game, when there was more than one maximal-yield cube, it picked a random one. All million games lasted exactly 65 passes. Although rare, there were occasional instances where only one cube had maximal yield. So maybe boxes of odd primes p1 < p2 < p3 always take (p1 * p2) passes? I explored boxes with p3<32. 10 odd primes are < 32, so C(10,3) =120 cases to consider. To limit run time, I excluded cases where volume > 4000; that excludes 36, leaving 84. I ran only 1000 games on those 84, with the random choice breaking maximal-yield ties. Of those 84, 75 (including 5x13x31) followed the suspected pattern — all 1000 games lasted the same number of passes. But the other 9 box sizes had games of varying length! I’ll post which those were a bit later. This seems very weird. — Mike