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.

A255561 Numbers whose binary representation traces a non-selfcrossing circuit in the honeycomb lattice when each one of its bits, from the most significant to the least significant, is interpreted as a direction to proceed at each vertex.

This page as a plain text file.
%I A255561 #21 Jun 18 2015 06:08:12
%S A255561 0,32,63,528,545,578,644,759,776,891,957,990,1007,2184,2321,2594,3003,
%T A255561 3140,3549,3822,3959,8481,8514,8580,8771,8772,8837,8969,9264,9288,
%U A255561 9350,9353,9482,9746,10167,10320,10337,10385,10508,10514,10772,11223,11300,11739,11751,11997,12093,12126,12143,12432,12449,12482,12578,12824,12836,13275
%N A255561 Numbers whose binary representation traces a non-selfcrossing circuit in the honeycomb lattice when each one of its bits, from the most significant to the least significant, is interpreted as a direction to proceed at each vertex.
%C A255561 Numbers n such that when we start scanning bits in the binary expansion of n, from the most to the least 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 the bits, we have eventually returned to the same vertex where we started from and none of the other vertices have been visited twice.
%C A255561 Indexing starts from zero, because a(0) = 0 is a special case, indicating an empty path, which certainly ends at the same vertex as where it starts from. For other cases, we always take first a right turn, because the most significant bit is always 1.
%H A255561 Antti Karttunen, <a href="/A255561/b255561.txt">Table of n, a(n) for n = 0..13242</a>
%H A255561 Wikipedia, <a href="http://en.wikipedia.org/wiki/Honeycomb_lattice">Hexagonal lattice</a>
%e A255561 32 ("100000" 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 will reach the same vertex where we started from.
%e A255561 63 ("111111" in binary) is included, because when we take six turns to the right in the hexagonal lattice, we will reach the same vertex where we started from.
%e A255561 528 ("1000010000" in binary) is included, because it traces the edges of two adjacent hexagons, returning to the same vertex where the path started from, which is the other of the two vertices shared by those hexagons.
%o A255561 (Scheme, with _Antti Karttunen_'s IntSeq-library)
%o A255561 (define A255561 (MATCHING-POS 0 0 (COMPOSE isA255561bitlist? bits->list)))
%o A255561 (define (bits->list n) (reverse! (bits-reversed->list n)))
%o A255561 (define (bits-reversed->list n) (if (zero? n) (list) (cons (modulo n 2) (bits-reversed->list (floor->exact (/ n 2))))))
%o A255561 (define (isA255561bitlist? bitlist) (let loop ((bitlist bitlist) (x 0) (y 0) (phase 0) (vv (list))) (cond ((null? bitlist) (and (zero? x) (zero? y))) ((member (cons x y) vv) #f) (else (let* ((d (first bitlist)) (newphase (modulo (+ phase d d -1) 6))) (loop (cdr bitlist) (+ x (x-delta newphase)) (+ y (y-delta newphase)) newphase (cons (cons x y) vv)))))))
%o A255561 (define (newphase p d) (modulo (+ p d d -1) 6))
%o A255561 (define (x-delta phase) (* (- (* 2 (floor->exact (/ phase 3))) 1) (- (modulo phase 3) 1)))
%o A255561 (define (y-delta phase) (* (- 1 (* 2 (floor->exact (/ phase 3)))) (floor->exact (/ (+ 1 (modulo phase 3)) 2))))
%Y A255561 Cf. A014486, A255571.
%Y A255561 Subsequence: A258004.
%K A255561 nonn,base
%O A255561 0,2
%A A255561 _Antti Karttunen_, Apr 13 2015