I would use the Sieve of Eratosthenes to sieve primes from 2-sqrt(n). As the Sieve runs in O(n^(3/2)) time, and it is using sqrt(n) for it's n, that would be O(n^(3/4)) based on your original number. And if none of the primes sieved are factors of n, then n is the largest prime.
17 Replies - 3583 Views - Last Post: 12 September 2010 - 05:01 PM
#17
Re: Largest Prime Factor
Posted 12 September 2010 - 04:59 PM
Is creating an algorithm for the Sieve of Eratosthenes difficult to create?
#18
Re: Largest Prime Factor
Posted 12 September 2010 - 05:01 PM
Check out Wikipedia as well as the snippets sections. There are tons of examples. It's basically nested for loops and a List.

New Topic/Question
Reply






MultiQuote

|