%I #31 May 30 2021 01:44:50
%S 1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,1,
%T 1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,1,1,1,1,-1,
%U 1,-1,1,-1,1,1,1,-1,1,-1,-1,-1,1,1,1
%N Babylonian Wurm - The change of direction in successive segments is recorded as 1 (clockwise) or -1 (counterclockwise).
%C A Babylonian Wurm is constructed by starting at (0,0) with a unit vector pointing North and then a clockwise turn with the root 2 length vector pointing NE. For subsequent segments, progressively concatenate the next longer vector with integral endpoints on a Cartesian grid. (The squares of the lengths of these vectors are A001481.) The direction of the new vector is chosen to minimize the change in direction from the previous vector. If there is a tie, the direction will be chosen so the wurm continues to turn in the same direction as the previous turn. - _Gordon Hamilton_, Mar 17 2015
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . 2 . 3 . . . . . . . . . . . . . .
%C . 1 . . . . 4 . . . . . . . . . . . .
%C . o . . . . . . . . . . . . . . . . .
%C . . . . . . . . 5 . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . 6 . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . 7 . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . 8 . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . 9 . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . .10 . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . .11 . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . .12 . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . .13 .
%C . . . . . . . . . . . . . . . . . . .
%C . . . . . . . . . . . . . . . . . . .
%C Is the number of consecutive 1's bounded? - _Gordon Hamilton_, Mar 31 2015
%H James Rayman, <a href="/A256175/b256175.txt">Table of n, a(n) for n = 1..10000</a>
%H James Rayman, <a href="/A256175/a256175_1.py.txt">Python program</a>
%e a(1) = 1 because the turn (0,0) to (0,1) to (1,2) is clockwise.
%e a(2) = 1 because the turn (0,1) to (1,2) to (3,2) is clockwise.
%e a(3) = 1 because the turn (1,2) to (3,2) to (5,1) is clockwise.
%e a(4) = 1 because the turn (3,2) to (5,1) to (7,-1) is clockwise.
%e a(5) = 1 because the turn (5,1) to (7,-1) to (7,-4) is clockwise.
%e At a(6) there is a choice of which direction to go because the change of direction would be the same for both the following:
%e (7,-1) to (7,-4) to (6,-7) AND (7,-1) to (7,-4) to (8,-7).
%e In the case of a tie we look back to see the direction of the turn in the previous step and since a(5) = 1 we copy that. So it is the first option that we must choose: (7,-1) to (7,-4) to (6,-7).
%e a(7) = 1 because the turn (7,-4) to (6,-7) to (4,-10) is clockwise.
%e a(8) = -1 because the turn (6,-7) to (4,-10) to (4,-14) is counterclockwise.
%o (Python) See Rayman link.
%Y Cf. A001481.
%Y See A342622 and A342623 for the coordinates of the Wurm.
%Y Cf. A342624, A342625, A342626, A342627.
%K sign,easy
%O 1
%A _Gordon Hamilton_, Mar 17 2015
%E Corrected and extended by _James Rayman_, Jan 19 2021