login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 5
0, 32, 63, 528, 545, 578, 644, 759, 776, 891, 957, 990, 1007, 2184, 2321, 2594, 3003, 3140, 3549, 3822, 3959, 8481, 8514, 8580, 8771, 8772, 8837, 8969, 9264, 9288, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

COMMENTS

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.

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.

LINKS

Antti Karttunen, Table of n, a(n) for n = 0..13242

Wikipedia, Hexagonal lattice

EXAMPLE

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.

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.

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.

PROG

(Scheme, with Antti Karttunen's IntSeq-library)

(define A255561 (MATCHING-POS 0 0 (COMPOSE isA255561bitlist? bits->list)))

(define (bits->list n) (reverse! (bits-reversed->list n)))

(define (bits-reversed->list n) (if (zero? n) (list) (cons (modulo n 2) (bits-reversed->list (floor->exact (/ n 2))))))

(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)))))))

(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

Cf. A014486, A255571.

Subsequence: A258004.

Sequence in context: A050708 A132300 A206371 * A116318 A225722 A195330

Adjacent sequences:  A255558 A255559 A255560 * A255562 A255563 A255564

KEYWORD

nonn,base

AUTHOR

Antti Karttunen, Apr 13 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 20 08:28 EDT 2021. Contains 348099 sequences. (Running on oeis4.)