Lots of useful things come in boxes. Shoes, soldering irons and… prime numbers? This simple project from [WhiskyTangoHotel] puts a list of prime numbers in a handy box. Press a button, get a prime.

Sure, it isn’t brain surgery: all that it is happening is that a Raspberry Pi is reading a number from a text file, then showing it on an LCD screen. But it’s well-documented project that shows how to tie together a number of things on the Pi, like writing to an I2C display and using a button to trigger a clean shutdown.

It might be a good starting project for the younger hacker or if you have a Pi pining for something to do. If you’re looking for more easy Raspberry Pi projects, check out our Enlightened Pi Contest.

That’s funny, I didn’t know you could get a prime from pi.

you cannot get a prime from the number Pi (3.1416), but you can from a raspberry Pi (computer), however there still is no real formula for primes, it is really – pretty much trial and error. Test each number sequentially =1,2,3,4,5,6,7…101,102,103… to infinity.

True, but the primes in this project are pre-stored in a file. They are not calculated on the fly. Clever!

I have used stored primes for various endeavors before, but I wonder if a pi would have the power to generate primes on the fly, say, starting with 6n+/-1 values and going until a prime is found. Somehow the beautiful delay at times would seem to add to the mystery.

https://hackaday.io/project/8137-prime-factor-reduction-sieve

Best I can do. One day I hope to be able to reverse it to generate prime numbers on the fly. Sorry

The RasPI can, of course, gen the primes on the fly. However the time to find the next prime starts to get a bit long after testing values of 100, 000 or so. Easy to test to see if it would fit your needs by just putting a simple python script into the RasPI and letting it run.