cp's OEIS Frontend

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.

A255938 Langton's ant walk: number of black cells on the infinite grid after the ant moves n times.

This page as a plain text file.
%I A255938 #38 Mar 11 2021 03:06:11
%S A255938 0,1,2,3,4,3,4,5,6,7,6,7,8,9,10,9,8,7,6,7,6,7,8,9,10,9,10,11,12,13,12,
%T A255938 11,10,9,10,9,10,11,12,13,12,13,14,15,16,15,14,13,12,13,12,11,12,13,
%U A255938 12,13,14,15,16,15,14,13,12,13,12,13,14,15,16,15,16,17
%N A255938 Langton's ant walk: number of black cells on the infinite grid after the ant moves n times.
%C A255938 The ant starts from a completely white grid.
%C A255938 From _Albert Lau_, Jun 19 2016: (Start)
%C A255938 After n steps, the direction in which the ant is facing is 90 degree * a(n). For each 360 degrees, the ant makes a full turn.
%C A255938 The ant's position after n steps is Sum_{k=1..n} e^(a(n)*i*Pi/2) when expressed as a complex number. (End)
%D A255938 D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 63.
%H A255938 Alois P. Heinz, <a href="/A255938/b255938.txt">Table of n, a(n) for n = 0..20000</a>
%H A255938 A. Gajardo, A. Moreira, and E. Goles, <a href="https://doi.org/10.1016/S0166-218X(00)00334-6">Complexity of Langton's ant</a>, Discrete Applied Mathematics, 117 (2002), 41-50.
%H A255938 Chris G. Langton, <a href="https://doi.org/10.1016/0167-2789(86)90237-X">Studying artificial life with cellular automata</a>, Physica D: Nonlinear Phenomena, 22 (1-3) (1986), 120-149.
%H A255938 Wikipedia, <a href="https://en.wikipedia.org/wiki/Langton&#39;s_ant">Langton's ant</a>.
%F A255938 a(n+104) = a(n) + 12 for n > 9976. - _Andrey Zabolotskiy_, Jul 05 2016
%t A255938 size = 10;
%t A255938 grid = SparseArray[{}, {size, size}, 1];
%t A255938 {X, Y, n} = {size, size, 0}/2 // Round;
%t A255938 While[1 <= X <= size && 1 <= Y <= size,
%t A255938      n += grid[[X, Y]] // Sow;
%t A255938      grid[[X, Y]] *= -1;
%t A255938      {X, Y} += {Cos[\[Pi]/2 n], Sin[\[Pi]/2 n]};
%t A255938      ] // Reap // Last // Last // Prepend[#, 0] &
%t A255938 (* _Albert Lau_, Jun 19 2016 *)
%Y A255938 Cf. A126978.
%K A255938 nonn,easy
%O A255938 0,3
%A A255938 _Arkadiusz Wesolowski_, Mar 11 2015