A290441 a(n) = A289677(3*n).
1, 3, 5, 13, 20, 44, 89, 192, 396, 814, 1610, 3130, 6103, 12229, 24736, 49879, 100747, 203765, 411403
Offset: 1
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
Suppose n=1. Then w = 0 ->000 -> w' = empty word, and w = 1 -> 11101 -> w' = 01 -> 0100 -> w'' = 0 -> 000 -> w''' = empty word. So a(1) = 4 by choosing w = 1. For n = 5 the orbit of the word 10010 begins 10010, 101101, 1011101, ..., 0000110111011101, and the next word in the orbit has already appeared. The orbit consists of 22 distinct words. From _David A. Corneth_, Aug 02 2017: (Start) The 5-letter word w = 10100 can be described as (a, b) = (5, 20). This is equivalent to (5, bitand(20, floor(2^7 / 7))) = (5, bitand(20, 18)) = (5, 16). As 16 >= 2^(5-1), w' = (5 + 1, bitand(16*16 + 13, floor(2^(5 + 3) / 7))) = (6, bitand(279, 36)) = (6, 4). w'' = w = (5, 16) so 10100 ~ 10000 ends in a period. (End) Words w that achieve a(1) through a(7) are 1, 10, 100, 0001, 10010, 100000, 0001000. - _N. J. A. Sloane_, Aug 17 2017
Table[nmax = 0; For[i = 0, i < 2^n, i++, lst = {}; w = IntegerString[i, 2, n]; While[! MemberQ[lst, w], AppendTo[lst, w]; If[w == "", Break[]]; If[StringTake[w, 1] == "0", w = StringDrop[w <> "00", 3], w = StringDrop[w <> "1101", 3]]]; nmax = Max[nmax, Length[lst]]]; nmax, {n, 1, 12}] (* Robert Price, Sep 26 2019 *) (* Or, using the (c,d) procedure: *) Table[nmax = 0; For[i = 0, i < 2^n, i++, c = n; d = i; lst = {}; While[! MemberQ[lst, {c, d}], AppendTo[lst, {c, d}]; If[c == 0, Break[]]; If[ d < 2^(c - 1), d = BitAnd[4*d, 2^(c - 1) - 1]; c--, d = BitAnd[16*d + 13, 2^(c + 1) - 1]; c++]]; nmax = Max[nmax, Length[lst]]]; nmax, {n, 1, 12}] (* Robert Price, Sep 26 2019 *)
from _future_ import division def A289676(n): c, k, r, n2, cs, ts = 0, 1+(n-1)//3, 2**((n-1) % 3), 2**(n-1), set(), set() for i in range(2**k): j, l = int(bin(i)[2:],8)*r, n2 traj = set([(l,j)]) while True: if j >= l: j = j*16+13 l *= 2 else: j *= 4 l //= 2 if l == 0: c += 1 ts |= traj break j %= 2*l if (l,j) in traj: cs |= traj break if (l,j) in cs: break if (l,j) in ts: c += 1 break traj.add((l,j)) return c # Chai Wah Wu, Aug 03 2017
Comments