Prime Numbers the Hard Way

By: spacewrench

2013-09-15 20:34:09

There's an artsy dude who got his Kickstarter mentioned on boingboing.  The project is a little mechanical counter with some smarts built in: every time you press a button, it computes and displays the next prime number.  It's $120.

I had a couple of 6-digit counters that I got from Surplus Gizmos, so I thought this would be a fun afternoon project.  It's almost like getting $120, except you can't spend it.

The video is an iPhone movie of my version computing primes from 137 to 167.  During the development (ha!  "Development!") I counted the number of primes between 2 and 1000000.  There are 78,498 of them (first is 2, last is 999,983) and the largest gap between primes is 114, between 492,113 and 492,227.  Just in case you're wondering.

The Teensy2 is overkill for this: the code is only 334 words (I think), and I have some ATtiny13s with 1K of Flash that would be perfect for this project.  I just have to ressurect my Teensy-based ATtiny programmer...

Back to archive index