That sounds correct to me, so long as you don’t mean that you should start with 3 and end with 3 cause then you’d have 1 * 2 * 3 * 3
Looking at that, 1 * 2 * 3 * 3, it’s easy to tell that you either should start with some other number than 3, or if you do start with 3, don’t include it again… Or even divide afterwards. But why do something extra and then undo it later, just complicated. Better to get it right from the start.
Remember my suggestion on leaving x unmodified and having a separate results variable?
I would only modify x if I was decreasing it towards 1 instead of counting upwards
You can also add prints which say each action that’s happening, for example each generated number and the value of the result after each multiplication - that’ll tell you everything going on and it’ll be easy to tell if and where something isn’t being done right and adjust as needed
before=3, n=1, after=3 <-- clearly wrong initial value
before=3, n=2, after=6
before=6, n=3, after=18
^ ^ ^
| | the multiplication is being done correctly
| the counting is right, so no need to change that
the value from last iteration is carrying over correctly
except for that the initial value isn't right