I’m a firm believer that if you’re having a problem writing your code, it is because you wrote bad pseudocode. Maybe it didn’t have enough detail or a bad layout. Or maybe I … I mean you … you just don’t know what you are doing. I bring this up because I wasted three hours last night trying to write this program in C++.
I got the prime checking function down fine but when it came to the factorization … I kept trying to do all the wrong things. I didn’t even get into how to store and verify the factors.