Akuna interview question

Code about factor a integer, probabilities, etc.