%I #47 Jan 13 2019 18:10:11
%S 1,2,1,6,4,14,1,14,12,62,8,126,28,30,1,30,28,1022,24,126,124,4094,16,
%T 2046,252,1022,56,32766,60,62,1,62,60,8190,56,174762,2044,8190,48,
%U 2046,252,254,248,8190,8188,16777214,32,4194302,4092,510,504,134217726,2044,2097150
%N The period of an n X 1 rectangular oscillator in the B1/S Life-like cellular automaton.
%C The seed in each case is a single live cell at the left end.
%C Terms of the form 2^k-1 have a period of 1 since all cells die.
%C In binary, all terms (except the 1's) have at least one 1 followed by at least one 0. The exceptions are the 36th and 94th terms and their derivatives, which have alternating 1's and 0's in their binary expansion.
%H Adam P. Goucher, <a href="/A268754/b268754.txt">Table of n, a(n) for n = 1..200</a> (terms for n = 1..99 from E-Hern Lee)
%H Lee Burnette, <a href="http://goo.gl/szXPO8">Variations of Life</a>.
%H Lee Burnette, <a href="http://play.starmaninnovations.com/static/d3applets/renders/WeNmxtzjTi.gif">Oscillator for n=10</a>.
%H Stack Exchange Network chat, <a href="http://chat.stackexchange.com/transcript/message/27539633#27539633">Initial message</a>.
%H Stack Exchange Network chat, <a href="http://chat.stackexchange.com/rooms/35699/electrons-in-a-wire">Electrons in a wire</a>.
%F No general formula for even-indexed terms is known. For odd-indexed terms, a(2n+1) = 2*a(n), except when n is of the form (2^k - 1), in which case a(n) = 1.
%e a(10) = 62 because a strip of 10 cells has period 62 in this rule.
%t g = Function[{sq, p}, Module[{l = Length[sq]},
%t Do[If[sq[[i]] == sq[[j]], Return[p^(j - 1) - p^(i - 1)]],
%t {j, 2, l}, {i, 1, j - 1}]]];
%t MPM = Algebra`MatrixPowerMod;
%t EventualPeriod = Function[{m, v, p},
%t Module[{n = Length[m], w, sq, k, primes},
%t sq = NestList[(MPM[#, p, p]) &, m, n];
%t w = Mod[Last[sq].v, p];
%t sq = Map[(Mod[#.w, p]) &, sq];
%t k = g[sq, p];
%t If[k == Null, k = p^n Apply[LCM, Table[p^r - 1, {r, 1, n}]]];
%t primes = Map[First, FactorInteger[k]];
%t primes = Select[primes, (# > 1) &];
%t While[Length[primes] > 0,
%t primes = Select[primes, (Mod[k, #] == 0) &];
%t primes = Select[primes, (Mod[MPM[m, k/#, p].w, p] == w) &];
%t k = k/Fold[Times, 1, primes];
%t ]; k ]];
%t mat = Function[{n}, Table[Boole[Abs[i - j] == 1], {i, 1, n}, {j, 1, n}]];
%t vec = Function[{n}, Table[Boole[i == 1], {i, 1, n}]];
%t Table[EventualPeriod[mat[n], vec[n], 2], {n, 1, 100}]
%t (* _Adam P. Goucher_, Jan 13 2019 *)
%o (Python)
%o def electron_period(n):
%o wire_mask = (1 << n) - 1
%o power = lam = 1
%o tortoise, hare = 1, 2
%o while tortoise != hare:
%o if power == lam:
%o tortoise = hare
%o power *= 2
%o lam = 0
%o hare = ((hare << 1) ^ (hare >> 1)) & wire_mask
%o lam += 1
%o return lam
%Y Even-indexed terms are exactly A160657. [corrected by _Adam P. Goucher_, Jan 13 2019]
%K nonn
%O 1,2
%A _Lee Burnette_, Feb 12 2016
|