Jamie Ly

Jamie Ly

Developer, student, person

Skip to content
  • Arts/Crafts
  • Programs
  • Writings
  • About

prime numbers

There are 4 posts tagged prime numbers.

Project Euler Problem 10 Solution: Clojure

Problem description, from Project Euler Find the sum of all the primes below N. Solution Brute-forced it again, but it still runs in less than 30 seconds (at least on my MacBook Pro). This one was simple using the Sieve of Eratosthenes from problem 7. The sieve, collapsed because it’s the same as from problem […]

in Programming | 305 Words

Project Euler Problem 7 Solution: Clojure

Problem Description, from Project Euler What is the n-th prime number? Problem Solution This was simple to solve using the Sieve created for the solution to problem #3. To make the program variable, we start with finding all primes less than 1000. If that is not enough to solve the problem, we double this “maximum” […]

in Programming | 280 Words

Project Euler Problem 3 Solution: Clojure

Problem description, from Project Euler What is the largest prime factor of the number N? Solution In previous problems, I was using a list of primes I got somewhere else. I figured it would be relevant to implement a prime-finding algorithm. I decided to go with simplicity, and implement the Sieve of Eratosthenes. It’s basically […]

in Programming | 491 Words

Project Euler Problem 5 Solution: Clojure

Problem description, from Project Euler What is the smallest number that is evenly divisible by all of the numbers from 1 to N? Solution The math Basically, we are finding the least common multiple (LCM) of the numbers (grade school math?). This can be done by generating the prime factors of each of the numbers. […]

in Programming | 692 Words

Archives

Independent Publisher empowered by WordPress