Prime Number Service on Google App Engine

Enigma PlugboardAs I mentioned earlier this week, I’ve decided to learn the Go programming language. I’ve also been very interested in Google App Engine, which lets you deploy applications to the cloud from a development sandbox. It’s like magic for web and mobile applications!

Since I’m so fond of prime numbers, I thought I’d build a web service for calculating them. It does some other fun stuff, too, like figuring out if a number is happy. It also caches primes in the Google Cloud Datastore with some minimal statistics. If you’d like to see the source code for the prime number service, it’s available on GitHub.

The next thing I did was write the simplest of all WordPress plugins to query the service and return the latest prime number in the sequence. This all happens in a post using the [nextprime] shortcode.1

The next prime number is 143141 and it's a happy one.

You can also visit the app itself and read about querying the service to get prime numbers for your own web page!

Learning Go and writing for the Google App Engine has been really fun. I’m ready for a new challenge! If you have a web application in mind, contact me and let’s figure out how to build it!


  1. Including this information has the side-effect of revealing how much traffic this page gets. 

One thought on “Prime Number Service on Google App Engine

  1. I should note that the part of this which should have been the hardest, which is implementing a fast primality tester in Go, didn’t need to happen. Go has a built-in Miller-Rabin primality test in its bignum library.

    (I know, that’s really nerdy. But you’re here to read about me being nerdy.)

Leave a Comment