Posts in optimization

Optimus Prime Optimizes Prime

Optimus Prime

Hi there folks. Optimus Prime here. Few of you know this, but when I’m not out blowing up bad guys with my ion-blaster and swinging my energon-axe, I enjoy solving Project Euler problems over a bowl of oatmeal and a cup of coffee at breakfast. Weird, right? It’s like seeing your teacher walking out on the street, or bumping in to your shrink at the grocery store. Anyway…

I wanted to talk to you about a piece of a Euler problem that I particularly enjoyed optimizing (the problem itself is here). It’s the method I call is_prime?, which, as it’s name suggests, checks to see if a given number is prime. Sure, I could use the built in ruby method Prime.prime?(n), but where would the fun be in that?

written in in optimization, prime numbers, project euler Read on →