%I #28 Jun 12 2024 09:40:44
%S 1,-3,1,-3,-2,-3,1,-3,1,-3,-2,-3,-2,-1,-2,-3,-2,-3,1,-3,1,-3,-2,-3,1,
%T -3,1,-3,-2,-3,-2,-1,-2,-3,-2,-3,-2,-1,-2,-1,3,-1,-2,-1,-2,-3,-2,-3,
%U -2,-1,-2,-3,-2,-3,1,-3,1,-3,-2,-3,1,-3,1,-3,-2,-3,-2
%N If 1, 2, and 3 represent the three 2D vectors (1,0), (0.5,sqrt(3)/2) and (-0.5,sqrt(3)/2) and -1, -2 and -3 are the negation of these vectors, then this sequence represents Gosper's island.
%C The sequence is generated by the rewriting rules
%C P(1) = 1,-3,1,
%C P(2) = 2,1,2,
%C P(3) = 3,2,3,
%C P(-3) = -3,-2,-3,
%C P(-2) = -2,-1,-2,
%C P(-1) = -1,3,-1.
%C The start is 1,2,3,-1,-2,-3.
%C Notice P(-x)= -P(x), since P(x) is symmetric.
%C Among the starting values, only the initial "1" is relevant for computation of the sequence, the image of the other elements (2,3,-1,-2,-3) becomes "pushed away" to infinity. - _M. F. Hasler_, Aug 06 2015
%H Paolo Xausa, <a href="/A229215/b229215.txt">Table of n, a(n) for n = 1..19683</a>
%H Arie Bos, <a href="http://arxiv.org/abs/1210.7123">Index notation of grid graphs</a>, arXiv:1210.7123 [cs.CG], 2012.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Gosper_curve">Gosper curve</a>
%H <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%e Start with 1,2,3,-1,-2,-3 and you get
%e in the first step 1,-3,1,2,1,2,3,2,3,-1,3,-1,-2,-1,-2,-3,-2,-3 and
%e in the second step 1,-3,1,-3,-2,-3,1,-3,1,2,1,2,1,-3, ... ,-1,-2,-3,-2,-3.
%e With each step the length increases by a factor of 3.
%t SubstitutionSystem[{t_ :> {{1,-3,1}, {2,1,2}, {3,2,3}}[[Abs[t]]]*Sign[t]}, {1}, {3}][[1]] (* _Paolo Xausa_, Jun 12 2024 *)
%o (PARI) (P(v)=concat(apply(i->[i,i-sign(i)*4^(i*i<2),i],v)));A229215=P(P(P(P([1])))) \\ To get a(n), ceil(log_3(n)) iterations are required. - _M. F. Hasler_, Aug 06 2015
%Y Cf. A229214.
%K easy,sign
%O 1,2
%A _Arie Bos_, Sep 24 2013
%E Definition corrected by _Kerry Mitchell_, Aug 06 2015