Strobogrammatic Numbers

A strobogrammatic number looks the same when it is rotated 180 degrees about the centre.
Examples are 0, 1, 8, 11, 69, 88, 101, 111, 181,... with the number 1 written like a vertical line. Only the numbers 0, 1, 6, 8, 9 may appear in a strobogrammatic number.
A strobogrammatic number can have any number of digits. If there is an odd number of digits the middle digit must be one of the numbers 0, 1 or 8.
However many digits there are the number must be symmetric about the midpoint, in the sense that the first and last
numbers must be the same, or 6 and 9, the second and second from last are 0, 1, 8 or 6 and 9 and so on.

Add comment

Security code