login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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).
2
1, 64, 65, 126, 127, 380, 381, 386, 387, 1056, 1057, 1090, 1091, 1156, 1157, 1274, 1275, 1286, 1287, 1288, 1289, 1518, 1519, 1552, 1553, 1782, 1783, 1784, 1785, 1796, 1797, 1914, 1915, 1980, 1981, 2014, 2015, 4096, 4097, 4158, 4159, 4160, 4161, 4222, 4223, 4348, 4349, 4368, 4369, 4598, 4599, 4600
OFFSET
0,2
COMMENTS
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.
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.
If n is a member, then A054429(n) is also a member.
LINKS
EXAMPLE
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.
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.
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.
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.
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.
PROG
(Scheme, with Antti Karttunen's IntSeq-library)
(define A255570 (MATCHING-POS 0 1 isA255570?))
(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))))))
(define (newphase p d) (modulo (+ p d d -1) 6))
(define (x-delta phase) (* (- (* 2 (floor->exact (/ phase 3))) 1) (- (modulo phase 3) 1)))
(define (y-delta phase) (* (- 1 (* 2 (floor->exact (/ phase 3)))) (floor->exact (/ (+ 1 (modulo phase 3)) 2))))
CROSSREFS
Subsequence: A255571.
Sequence in context: A272297 A291094 A291965 * A255571 A151984 A194769
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Apr 13 2015
STATUS
approved