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.
%I A335358 #27 Nov 12 2021 08:57:32 %S A335358 0,1,1,2,3,3,2,3,3,4,5,5,6,7,7,8,9,9,8,9,9,8,7,7,6,7,7,8,9,9,8,9,9,10, %T A335358 11,11,12,13,13,14,15,15,16,15,15,16,17,17,18,19,19,20,21,21,20,21,21, %U A335358 22,23,23,24,25,25,26,27,27,26,27,27,26,25,25,24 %N A335358 a(n) is the X-coordinate of the n-th point of the Koch curve; sequence A335359 gives Y-coordinates. %C A335358 Coordinates are given on a hexagonal lattice with X-axis and Y-axis as follows: %C A335358 Y %C A335358 / %C A335358 / %C A335358 0 ---- X %C A335358 We can build the Koch curve as follows: %C A335358 - start from the origin, %C A335358 - for k = 0, 1, ...: %C A335358 - compute t as the number of 1's minus the number of 2's %C A335358 in the base-4 representation of n (t = A065359(n)), %C A335358 - move one step forward with an angle of t * 60 degrees %C A335358 with respect to the X-axis. %H A335358 Rémy Sigrist, <a href="/A335358/b335358.txt">Table of n, a(n) for n = 0..8192</a> %H A335358 Artem Litvinov, <a href="https://docs.google.com/document/d/1FUUuR99WPY3tXgL1XXdOGkiGcfvC2eyh74WIwfZGyvA/view">A study of the Koch polyline</a>, 2021 [in Russian]. %H A335358 Wikipedia, <a href="https://en.wikipedia.org/wiki/Koch_snowflake">Koch snowflake</a> %H A335358 <a href="/index/Con#coordinates_2D_curves">Index entries for sequences related to coordinates of 2D curves</a> %F A335358 From _Andrey Zabolotskiy_, Nov 12 2021: (Start) %F A335358 a(2*n) = a(n) + 2*y(n), %F A335358 y(2*n) = a(n) - y(n), %F A335358 where y(k) = A335359(k). See Litvinov, 2021. (End) %e A335358 The Koch curve starts (on a hexagonal lattice) as follows: %e A335358 . . . . . . + . . . . . . %e A335358 /8\ %e A335358 . . . . +---+ +---+ . . . . %e A335358 6\ 7 9 /10 %e A335358 . . . + . + . + . + . . . %e A335358 /2\ /5 \ / \ %e A335358 . +---+ +---+ . . +---+ +---+ . %e A335358 0 1 3 4 12 13 15 16 %e A335358 Hence, a(4) = a(5) = a(7) = a(8) = 3. %o A335358 (PARI) { hex = [1,I,I-1,-1,-I,1-I]; z=0; for (n=0, 72, print1 (real(z)", "); q=digits(n, 4); d=sum(k=1, #q, if (q[k]==1, +1, q[k]==2, -1, 0)); z+=hex[1+d%#hex]) } %Y A335358 Cf. A065359, A335359. %K A335358 nonn,look,base %O A335358 0,4 %A A335358 _Rémy Sigrist_, Jun 03 2020