OFFSET
1,2
COMMENTS
This sequence can be represented as a binary tree. Each left hand child is produced as A269361(1+n), and each right hand child as A269363(n), when the parent node contains n:
|
...................1...................
2 3
4......../ \........6 5......../ \........7
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
8 12 16 15 9 11 10 22
13 24 18 38 40 48 33 46 20 14 32 27 17 19 25 44
etc.
An example of (suspected) "entanglement permutation" where the other pair of complementary sequences is generated by a greedy algorithm.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..8192
Antti Karttunen, Entanglement Permutations, 2016-2017
PROG
(Scheme, with defineperm1-macro from Antti Karttunen's IntSeq-library)
(defineperm1 (A269366 n) (cond ((= 1 n) n) ((even? n) (A269361 (+ 1 (A269366 (/ n 2))))) (else (A269363 (A269366 (/ (- n 1) 2))))))
(define (A269365 n) (A269366 (- n))) ;; The negative side gives the values for the inverse function (from the cache).
;; We consider a > b (i.e. not less than b) also in case a is #f.
;; (Because of the stateful caching system used by defineperm1-macro):
(define (not-lte? a b) (cond ((not (number? a)) #t) (else (> a b))))
CROSSREFS
KEYWORD
AUTHOR
Antti Karttunen, Feb 25 2016
STATUS
approved