Print rotation-safe numbers
CJam, 46 44 43 42 bytes
l~),{_A%g1$s_6890s-!\_69s_W%erW%=!&&'.*N}/
I think there's some room for improvement.
Test it here.
Explanation
l~),{_A%g1$s_6890s-!\_69s_W%erW%=!&&'.*N}/
l~ "Read an eval input.";
), "Get range from 0 to n.";
{ }/ "For each...";
_ "Get a copy of the integer.";
A%g "Ends with digit other than 0?";
1$s_ "Get another copy, convert to string, get a copy.";
0689s-! "Contains rotation-safe digits?";
\ "Swap with other copy.";
_ "Get another copy.";
69s_W%er "Swap 6 and 9.";
W% "Reverse.";
=! "Is different from original?";
&& "AND all three conditions.";
'.* "If true, push a period (else, an empty string).";
N "Push a newline.";
CJam, 46 45 43 42 bytes
ri){Is___69`96`erW%=!\6809`-!&IA%g&'.*N}fI
I think it can be golfed a little more.
Takes n
from STDIN.
Try it online here
APL 66
∊' ',¨{a←⌽'0.....9.86'[⎕D⍳b←⍕⍵]⋄'.'∊a:b⋄('0'=⊃a)∨⍵=⍎a:b⋄b,'.'}¨0,⍳
Explanation:
¨0,⍳ applies the function to each number 0-n
a←⌽'0.....9.86'[⎕D⍳b←⍕⍵] inverts 6s and 9s, leaving 8s and 0s, and replacing other numbers with dots. Reverses vector after substitution.
'.'∊a if there is a dot in the number....
('0'=⊃a) .. or if the number starts with 0...
⍵=⍎a or if the (inverted) number is the same as original
:b then print the original number
b,'.' else print a dot in the end
∊' ',¨ Finally to give the result in the asked format i add a single space after each result and join them all
Try it on tryapl.org
Note that in the online interpreter the ⍎ function doesn't work so i had to substitute it with 2⊃⎕VFI which does the same in this case, executes and returns the number, given a string.