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

10th Mar 2020, 11:19 AM
Alvaro Sanchez
Alvaro Sanchez - avatar
1 ответ
+ 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
10th Mar 2020, 11:51 AM
Tibor Santa
Tibor Santa - avatar