Prime Factorizations method

i did not follow through sirs method , i wrote my own code first https://onlinegdb.com/rkxD4defU can u check it if it is good ? i have inserted comments for your refferal ! Thanks

You can read here for better understanding.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.