Primes

All posts tagged Primes

Problem: Find the sum of all the primes below two million. Commentary: If you're not careful, this problem can really get you in R. In poking around the internet, there are a few solutions to this problem, but all the ones I've tested are slow. Some, even from people who are better at R than me, are VERY slow. That linked one in particular took 6 minutes and 8.728000 seconds to complete. My Read more >>
I was hoping to begin tinkering a bit with the multicore package in R beyond some extremely trivial examples. Thanks to a combination of R's dumb quirkiness (for example, being worthless on loops), my poor planning, and general bad programming, my Saturday afternoon tinkering project is ultimately worthless in fulfilling that purpose. I was really hoping to take the prime searcher I had been using Read more >>
Problem: What is the 10001st prime number? Commentary: So it's finally time to discuss my prime-searching algorithm, as promised back in Problem 5. We will find primes in the following way: 2 and 3 are prime We examine the odd integers (having already discovered the only even prime) starting with $latex i=5$. First, check if $latex i$ is of the form $latex 6k+3$ for some integer $latex Read more >>
Problem: What is the largest prime factor of the number 600851475143 ? Commentary: This problem is not very hard, and there is much less of interest to say about it than in problems 2 and 25. The only real hitch is knowing what a prime is and knowing a few things about factorization. As it turns out, there is a surprising amount of research--even current day research, regarding factorizations Read more >>