0
In java, what would be the most efficient algorithm to obtain the prime numbers that compose a Natural number?
Input: int n = number n may be already a prime number but you need to get the primes that compose it ordered from the lowest to the highest
1 Resposta
+ 4
You can get some ideas here:
https://www.sololearn.com/learn/4714/?ref=app
Also, specific to java, there are a couple of useful built-in methods in the BigInteger class that support calculation with primes
https://www.tutorialspoint.com/java/math/biginteger_nextprobableprime.htm