This looks much more optimized than looping till the number itself. Here goes the code: import java. It became feasible to generate complex and longer codes that were much, much difficult to crack.
People Also Read:. Amazingly, it is the process of using prime numbers to encode information. Scanner; import java.
But this logic can be further optimized to only loop through the square root of the number instead of the number itself, as shown in below example. Most of the modern computer cryptography is dependent on making use of prime factors of large numbers.
However, this program prompts for user input.