OFFSET
0,2
COMMENTS
This notation is used by Penrose for specifying Turing machine examples. In general, this notation is much more compact than unary. Because no number encoded by this notation contains two or more consecutive 1's, there are an infinite number of additional strings available such as 110, 1110, 11110, ... for specifying delimiters (in lists of numbers), operations, etc. In some contexts, zero may alternately be represented by no symbol at all, for example, when there are two immediately-consecutive delimiters (commas).
REFERENCES
R. Penrose, The Emperor's New Mind, Oxford, 1989, pp. 42-46.
LINKS
Rick L. Shepherd, Table of n, a(n) for n = 0..9999
EXAMPLE
MAPLE
a:= n-> (l-> parse(cat(seq(10*l[-i], i=1..nops(l)))))(convert(n, base, 2)):
seq(a(n), n=0..42); # Alois P. Heinz, Jan 08 2021
MATHEMATICA
Table[FromDigits[Flatten[IntegerDigits[n, 2]/.(1->{1, 0})]], {n, 0, 40}] (* Harvey P. Dale, Sep 07 2019 *)
PROG
(PARI)
{a(n) = my(B, k);
if(n >= 0,
B = List(binary(n)); k = 1;
while(k <= #B,
if(B[k] == 1,
k++; listinsert(B, 0, k));
k++);
sum(k = 1, #B, B[k]*(10^(#B - k))))}
(Python)
def a(n): return int(bin(n)[2:].replace('1', '10'))
print([a(n) for n in range(35)]) # Michael S. Branicky, Jan 08 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rick L. Shepherd, May 12 2018
STATUS
approved