Dihedral prime

A dihedral prime or dihedral calculator prime is a prime number that still reads like itself or another prime number when read in a seven-segment display, regardless of orientation (normally or upside down), and surface (actual display or reflection on a mirror). The first few decimal dihedral primes are


 * 2, 5, 11, 101, 181, 1181, 1811, 18181, 108881, 110881, 118081, 120121, 121021, 121151, 150151, 151051, 151121, 180181, 180811, 181081.

The smallest dihedral prime that reads differently with each orientation and surface combination is 120121 which becomes 121021 (upside down), 151051 (mirrored), and 150151 (both upside down and mirrored).

The digits 0, 1 and 8 remain the same regardless of orientation or surface (the fact that 1 moves from the right to the left of the seven-segment cell when reversed is ignored). 2 and 5 remain the same when viewed upside down, and turn into each other when reflected in a mirror. In the display of a calculator that can handle hexadecimal, 3 would become E upon either reflection or upside down arrangement, but E being an even digit, the three cannot be used as the first digit because the reflected number will be even. Though 6 and 9 become each other upside down, they are not valid digits when reflected, at least not in any of the numeral systems pocket calculators usually operate in. Similarly, A is kept unchanged upon reflection, but its upside down image is not a valid digit. In addition, d and b are reflections of each other (in seven-segment display representations of hexadecimal digits, b and d are usually represented as lowercase while A, C, E and F are presented in uppercase), but their upside down images are not valid digits either. (Much as the case is with strobogrammatic numbers, whether a number, whether prime, composite or otherwise, is dihedral partially depends on the typeface being used. In handwriting, a 2 drawn with a loop at its base can be strobogrammatic to a 6, numbers that are of little use for the purpose of prime numbers; in the character design used on U.S. dollar bills, 5 reflects to a 7 when reflected in a mirror, while 2 resembles a 7 upside down.)

Strobogrammatic primes that don't use 6 or 9 are dihedral primes. This includes repunit primes and all other palindromic primes which only contain digits 0, 1 and 8 (in binary, all palindromic primes are dihedral). It appears to be unknown whether there exist infinitely many dihedral primes, but this would follow from the conjecture that there are infinitely many repunit primes.

The palindromic prime 10180054 + 8×(1058567−1)/9×1060744 + 1, discovered in 2009 by Darren Bedwell, is 180,055 digits long and may be the largest known dihedral prime.