Skip to main content
Commonmark migration
Source Link

#Python 2, 130 116 113 bytes

Python 2, 130 116 113 bytes

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

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

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

Expanded:

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

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.

#Python 2, 130 116 113 bytes

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

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

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

Expanded:

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

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.

Python 2, 130 116 113 bytes

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

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

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

Expanded:

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

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.

edited body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

#Python 2, 130 116 113 bytes

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

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

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

Expanded:

def f(n):
 S=`n`        
 n and f(n-1)                                      # Recurse if not 0                                     
 print S+"."*all([n%10,                            # Not divisible by 10
                  set(S)<=set("0689"),             # Consists of 0689
                  (u""+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.

#Python 2, 130 116 113 bytes

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

Defines a function f which prints the numbers to STDOUT, in ascending 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
                  (u""+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.

#Python 2, 130 116 113 bytes

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

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

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

Expanded:

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

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.

added 3 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

#Python 2, 130 116116 113 bytes

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

Defines a function f which prints the numbers to STDOUT, in descendingascending 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[u""+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.

#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.

#Python 2, 130 116 113 bytes

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

Defines a function f which prints the numbers to STDOUT, in ascending 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
                  (u""+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.

added 269 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading