Skip to main content
2 of 5
added 269 characters in body
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

#Python 2, 130 116 bytes

def f(n):S=`n`;print S+"."*all([n%10,set(S)<=set("0689"),unicode(S[::-1]).translate({54:57,57:54})!=S]);n and f(n-1)

Defines a function f which prints the numbers to STDOUT, in descending order.

This time I thought I'd take a leaf out of @feersum's book with .translate :)

Expanded:

def f(n):
 S=`n`                                             
 print S+"."*all([n%10,                            # Not divisible by 10
                  set(S)<=set("0689"),             # Consists of 0689
                  unicode(S[::-1]).translate(
                  {54:57,57:54})!=S])              # When rotated is not itself
 n and f(n-1)                                      # Recurse if not 0

Previous solution:

def f(n):S=`n`;print S+"."*all([n%10,set(S)<=set("0689"),eval("S[::-1]"+".replace('%s','%s')"*3%tuple("6a96a9"))!=S]);n and f(n-1)

Thanks to @xnor for showing me the .replace trick some time ago.

Sp3000
  • 61.9k
  • 13
  • 115
  • 287