27
1
Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise.
0
, 1
, and 8
have rotational symmetry. 6
becomes 9
and vice versa.
Sequence of numbers producing truthy results: OEIS A000787
0, 1, 8, 11, 69, 88, 96, 101, 111, 181, 609, 619, 689, 808, 818, 888, 906, 916, 986, 1001, 1111, 1691, 1881, 1961, 6009, 6119, 6699, 6889, 6969, 8008, 8118, 8698, 8888, 8968, 9006, 9116, 9696, 9886, 9966, 10001, 10101, 10801, 11011, 11111, 11811, 16091, ...
This question is inspired by my own reputation at the time of posting: 6009
.
This looks like a dupe of Print rotation-safe numbers.
– xnor – 2016-04-15T20:56:05.9802@xnor They're not the same at all. That question involves whether the number would become another valid number upon rotation (and append a period to keep it distinct), not whether it is the same number. I looked into that question before posting mine. – mbomb007 – 2016-04-15T21:18:49.533
@mbomb007 My mistake. I reopened. – xnor – 2016-04-15T21:21:23.367
May we take the input as a string? – xnor – 2016-04-15T21:26:26.797
@xnor If the language has numeric types, it should use them, for function parameters, for example. But if, in Python for example, you take
raw_input
, the user entered an integer, which would become a string behind the scenes. That's fine. – mbomb007 – 2016-04-15T21:32:42.673