OFFSET
1,2
COMMENTS
It is conjectured that this sequence is not only injective, but also surjective on N, i.e., that it is a true permutation of natural numbers.
LINKS
EXAMPLE
After the initial a(1) = 1, for obtaining the value of a(2) we try the first unused number, which is 2, but (1*2)+1 = 3, which in binary is "11", thus 2 is not qualified at this point of time. So next we try 3, and (1*3)+1 = 4, which in binary is "100", and that satisfies our criterion (no adjacent 1-bits), thus we set a(2) = 3.
For a(3), we test with the least unused numbers 2, 4, 5, etc., yielding products (3*2)+1 = 7 = "111", (3*4)+1 = 13 = "1101" and (3*5)+1 = 16 = "10000" in binary, and only 5 satisfies the criterion, thus we set a(3) = 5.
PROG
(Scheme, with defineperm1-macro from Antti Karttunen's IntSeq-library)
(defineperm1 (A266121 n) (cond ((= 1 n) n) (else (let ((prev (A266121 (- n 1)))) (let loop ((k 1)) (cond ((and (not-lte? (A266122 k) (- n 1)) (isa003714? (+ 1 (* k prev)))) k) (else (loop (+ 1 k)))))))))
(define (isA003714? n) (= (* 3 n) (A003987bi n (* 2 n)))) ;; Where A003987bi implements bitwise-XOR (see A003987).
;; 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
Left inverse: A266122 (also the right inverse if this sequence is a permutation of natural numbers).
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 23 2015
EXTENSIONS
Minor typo in the description corrected by Antti Karttunen, Feb 25 2016
STATUS
approved