Make the cpp prime function more efficient
Fix cpp is_prime function and bring same improvements to Java and Python
Fix Problem 50