Being insane in the membrane, I like to try unusual stuff.

My latest thing is that I want to find primes that look the same upside-down as right side up. This means that they have to end in 1, since the only digits available are 0,1,2,5, and 8. The exception here is 5, which is prime when it's only one digit, 5.

I've attempted loops in C with pfgw, with limited success. In this case, I'm hoping to test primality with Alperton's ECPP app. I'm headed over to Mersenne Forum after this message, in the hopes someone can help me compile it.

The reason I'm here is that I'm hoping someone can help write a program, in DOS or C++, that will write all the numbers that look the same upside-down as right-side-up from, say, 1 to a billion, and save them to a file. Something that I can edit to increase the upper bound if I want.

Can you guys help me?

Edit: I just discovered Alperton's app is a couple of Java files. How the heck do you run them without using the browser?