Background
You are working for some board-game manufacturer and need to produce wooden tiles with the numbers from 0 to n engraved on them for some game. However, without further ado, some tiles would become indistinguishable, e.g., 6 and 9. To avoid this, you have to equip numbers that can be confused with others (and only those) with a disambiguating dot, e.g., you would have tiles like 9. or 6089..
Unfortunately, you need to use some old, yet programmable wood-engraving device for this, whose interface is so broken that you have to encode every character of the program by hand in an unspeakably tedious process. Fortunately the device understands every existing programming language. Thus you are looking for the shortest program that prints such tiles.
Actual task
Write the shortest program that:
- Takes a positive integer n as input. How the input is read is up to you.
- Prints each of the numbers from 0 to n (0 and n included) exactly once in an order of your choice, separated by a single whitespace character (including newline). The numbers are to be printed without leading zeros.
- Appends a dot (.) to every number that turns into another, valid number upon rotation by π (180 °), even if that number is larger than n. Your typeface’s 0 and 8 are rotation-symmetric and the 9 is a rotated 6. The 2 and 5 are distinct upon rotation; the 1 is not rotation-symmetric. Numbers with leading zeros are not valid.
Examples
Each of the following numbers has to be printed exactly this way:
2
4
5
6.
8
9.
16
60
66.
68.
69
906
909.
8088.
9806.
9886
9889.
60
be60.
? \$\endgroup\$