Electrons bouncing in a wire Imagine a &quot;wire&quot; that has n spaces. Imagine further that there are &quot;electrons&quot; in that wire. These electrons only live for one unit of time. Any spaces in the wire that are adjacent to exactly one electron become an electron. In Game of Life terminology, this is B1/S.
For example, this is a wire of length 10, with period 62.

Rules

Input, n, is a single, positive integer.
Output must be a single integer denoting the period of a wire of length n.
The starting state is a single electron at one end of the wire.
The period does not necessarily include the starting state. Some lengths never return to the starting state, but all of them are periodic.
A static wire (i.e., one without electrons) has period 1.
Boundary conditions are not periodic. That is, the wire is not toroidal in any way.

Test cases
Special thanks to orlp for producing this list. (I have verified it up to n=27.)
1 1
2 2
3 1
4 6
5 4
6 14
7 1
8 14
9 12
10 62
11 8
12 126
13 28
14 30
15 1
16 30
17 28
18 1022
19 24
20 126
21 124
22 4094
23 16
24 2046
25 252
26 1022
27 56
28 32766
29 60
30 62
31 1
32 62
33 60
34 8190
35 56
36 174762
37 2044
38 8190
39 48
40 2046
41 252
42 254
43 248
44 8190
45 8188

You can see test cases for n=2 through 21 here with my Game-of-Life-esque simulator: Variations of Life.

EDIT: the sequence here has been published as A268754!
Python 2, 148 142 87 bytes
n=input()
p=l=1
t=1
h=2
while t!=h:
 if p==l:t,l,p=h,0,p*2
 h=h/2^h*2%2**n;l+=1
print l

Uses Brent's cycle detection algorithm, and thus actually runs fast.

I have also written an animation in Python (both 2 &amp; 3 work). It needs pyglet to run. You can view the animation by running:
python -m pip install --user pyglet
curl -s https://gist.githubusercontent.com/orlp/f32d158130259cbae0b0/raw/ | python

(Feel free to download the gist and inspect the code before running.) You can press the + and - keys to increase/decrease the n being visualized.

And finally, for those interested in exploring this number sequence further, here is a readable version (this was used to generate the test cases above):
# Brent's cycle detection, modified from wikipedia.
def electron_period(n):
    wire_mask = (1 &lt;&lt; n) - 1
    power = lam = 1
    tortoise, hare = 1, 2
    while tortoise != hare:
        if power == lam:
            tortoise = hare
            power *= 2
            lam = 0
        hare = ((hare &lt;&lt; 1) ^ (hare &gt;&gt; 1)) &amp; wire_mask
        lam += 1
    return lam