|
|
A094912
|
|
Output from a certain finite automaton when fed binary representation of n read from right to left.
|
|
2
|
|
|
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
There are 3 states. Start in state A.
If in A and 0 arrives go to A
If in A and 1 arrives go to B
If in B and 0 arrives go to C
If in B and 1 arrives go to A
If in C and 0 arrives go to A
If in C and 1 arrives go to C
If end in A, B, C then output 0, 0, 1 respectively.
|
|
LINKS
|
J.-P. Allouche and M. Mendes France, Automata and Automatic Sequences, in: Axel F. and Gratias D. (eds), Beyond Quasicrystals. Centre de Physique des Houches, vol 3. Springer, Berlin, Heidelberg, pp. 293-367, 1995; DOI https://doi.org/10.1007/978-3-662-03130-8_11.
J.-P. Allouche and M. Mendes France, Automata and Automatic Sequences, in: Axel F. and Gratias D. (eds), Beyond Quasicrystals. Centre de Physique des Houches, vol 3. Springer, Berlin, Heidelberg, pp. 293-367, 1995; DOI https://doi.org/10.1007/978-3-662-03130-8_11. [Local copy]
|
|
EXAMPLE
|
a(10) = 1: 10 = 1010, read from right: A->A->B->C, so output a 1.
|
|
MAPLE
|
T:= <<1, 3, 1>|<2, 1, 3>>:
a:= proc(n)
local L, state, i;
L:= convert(n, base, 2);
state:= 1;
for i from 1 to nops(L) do
state:= T[state, L[i]+1];
od:
[0, 0, 1][state];
end proc:
|
|
PROG
|
(PARI) {m=104; for(n=0, m, tape=binary(n); d=length(tape); state="A"; for(j=0, d-1, in=tape[d-j];
state=if(state=="A", if(in==0, "A", "B"), if(state=="B", if(in==0, "C", "A"), if(in==0, "A", "C"))));
print1(if(state=="A"||state=="B", 0, 1), ", "))} \\ Klaus Brockhaus, Jun 23 2004
(Haskell)
a094912 n = a 2 n where
a s 0 = 0 ^ s
a s x = a (t s b) x' where (x', b) = divMod x 2
t 2 0 = 2; t 2 1 = 1; t 1 0 = 0; t 1 1 = 2; t 0 0 = 2; t 0 1 = 0
-- state encoding: A = 2, B = 1, C = 0.
(Python)
def delta(q, a):
if q == "A": return {"0": "A", "1": "B"}[a]
if q == "B": return {"0": "C", "1": "A"}[a]
return {"0": "A", "1": "C"}[a]
def a(n):
q = "A"
for a in bin(n)[2:][::-1]: q = delta(q, a)
return int(q == "C")
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
A very interesting paper. I only looked though it as far as page 12. Perhaps some reader would read to the end and add appropriate references to it from other entries in the OEIS, as well as adding any new sequences that are found. A similar remark could be made about many papers on Jean-Paul Allouche's web site. - N. J. A. Sloane.
|
|
STATUS
|
approved
|
|
|
|