C#, 343 characters
Way too long, but anyway:
namespace System.Linq{class C{static void Main(){int n=int.Parse(Console.ReadLine());for(int i=0;i<=n;i++){var b=i+"";var c=b.Replace("6","9");Console.Write(b+(b.All(x=>x=='0'|x=='8'|x=='6'|x=='9')&(b.Contains('6')|b.Contains('9'))&!b.EndsWith("0")&!(b.Count(x=>x=='6')==b.Count(x=>x=='9')&new String(c.Reverse().ToArray())==c)?". ":" "));}}}}
How does it work? To add a period to the number, it must match the following requirements:
- Consists only of
0
, 8
, 6
and 9
.
- Has at least one
6
or 9
.
- Does not end with a zero.
- Is not the same number when you rotate it:
- If a number has an equal amount of
6
s and 9
s, and
- if
c
= the number with all 6
s replaces with 9
s,
- and reversed
c
== c
,
- then: the rotated number is the same as the number itself.
The numbers are separated by a space.
Code with indentation:
namespace System.Linq
{
class C
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
for (int i = 0; i <= n; i++)
{
var b = i + "";
var c = b.Replace("6", "9");
Console.Write(b +
(b.All(x => x == '0' | x == '8' | x == '6' | x == '9') &
(b.Contains('6') | b.Contains('9')) & !b.EndsWith("0") &
!(b.Count(x => x == '6') == b.Count(x => x == '9') &
new String(c.Reverse().ToArray()) == c) ? ". " : " "));
}
}
}
}