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.

A255570 Numbers whose binary representation traces a closed circuit in honeycomb lattice when its bits, from the least to the second most significant bit, are interpreted as directions to proceed at each vertex. (The most significant 1-bit is ignored).

This page as a plain text file.
%I A255570 #14 Apr 30 2015 21:43:09
%S A255570 1,64,65,126,127,380,381,386,387,1056,1057,1090,1091,1156,1157,1274,
%T A255570 1275,1286,1287,1288,1289,1518,1519,1552,1553,1782,1783,1784,1785,
%U A255570 1796,1797,1914,1915,1980,1981,2014,2015,4096,4097,4158,4159,4160,4161,4222,4223,4348,4349,4368,4369,4598,4599,4600
%N A255570 Numbers whose binary representation traces a closed circuit in honeycomb lattice when its bits, from the least to the second most significant bit, are interpreted as directions to proceed at each vertex. (The most significant 1-bit is ignored).
%C A255570 Numbers n such that when we start scanning bits in the binary expansion of n, from the least to the most significant end, and when we interpret each bit as to a direction which to turn at each vertex (e.g., 0 = left, 1 = right) when traversing the edges of honeycomb lattice, then, when we have consumed all except the most significant 1-bit (which is ignored), we have eventually returned to the same vertex where we started from.
%C A255570 Indexing starts from zero, because a(0) = 1 is a special case, indicating an empty path, which thus ends at the same vertex as where it started from.
%C A255570 If n is a member, then A054429(n) is also a member.
%H A255570 Antti Karttunen, <a href="/A255570/b255570.txt">Table of n, a(n) for n = 0..18484</a>
%H A255570 Wikipedia, <a href="http://en.wikipedia.org/wiki/Honeycomb_lattice">Hexagonal lattice</a>
%e A255570 64 ("1000000" in binary) is included, because when we take six turns to the left in the hexagonal lattice, we will reach the same vertex where we started from.
%e A255570 65 ("1000001" in binary) is included, because if we take first turn to the right at some vertex, and then five turns to the left in succession, we also reach the same vertex we started from.
%e A255570 126 ("1111110" in binary) is included, because if we take first turn to the left at some vertex, and then five turns to the right in succession, we also reach the same vertex we started from.
%e A255570 127 ("1111111" in binary) is included, because if we take six turns to the right in the hexagonal lattice, we will reach the same vertex where we started from.
%e A255570 380 ("101111100" in binary) is included, because it traces a path, where we first turn left from the starting vertex, then circumambulate a hexagon clockwise, after which we come back to the starting vertex. Note that the vertex next to the starting vertex is visited twice.
%o A255570 (Scheme, with _Antti Karttunen_'s IntSeq-library)
%o A255570 (define A255570 (MATCHING-POS 0 1 isA255570?))
%o A255570 (define (isA255570? n) (let loop ((n n) (x 0) (y 0) (phase 0)) (cond ((= 1 n) (and (zero? x) (zero? y))) (else (let* ((d (modulo n 2)) (newphase (modulo (+ phase d d -1) 6))) (loop (/ (- n d) 2) (+ x (x-delta newphase)) (+ y (y-delta newphase)) newphase))))))
%o A255570 (define (newphase p d) (modulo (+ p d d -1) 6))
%o A255570 (define (x-delta phase) (* (- (* 2 (floor->exact (/ phase 3))) 1) (- (modulo phase 3) 1)))
%o A255570 (define (y-delta phase) (* (- 1 (* 2 (floor->exact (/ phase 3)))) (floor->exact (/ (+ 1 (modulo phase 3)) 2))))
%Y A255570 Cf. A014486, A054429.
%Y A255570 Subsequence: A255571.
%K A255570 nonn,base
%O A255570 0,2
%A A255570 _Antti Karttunen_, Apr 13 2015