# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a096114
Showing 1-1 of 1
%I A096114 #16 Sep 05 2017 04:04:38
%S A096114 1,2,3,5,4,6,10,11,9,8,7,12,19,20,21,23,22,18,16,17,15,14,13,24,37,38,
%T A096114 39,41,40,42,46,47,45,44,43,36,31,32,33,35,34,30,28,29,27,26,25,48,73,
%U A096114 74,75,77,76,78,82,83,81,80,79,84,91,92,93,95,94,90,88,89,87,86,85,72
%N A096114 a(1)=1, a(2)=2, a(3*2^k) = 3*2^k, a(3*2^k + i) = 3*2^k + a(3*2^k - i), for i in range [1, 3*2^k - 1].
%H A096114 Ivan Neretin, Table of n, a(n) for n = 1..12288
%H A096114 Index entries for sequences that are permutations of the natural numbers
%t A096114 a = {1, 2}; Do[a = Join[a, {3*2^k}, 3*2^k + Reverse[a]], {k, 0, 4}]; a (* _Ivan Neretin_, Sep 04 2017 *)
%o A096114 (MIT Scheme:) (define (A096114 n) (cond ((< n 3) n) ((and (zero? (modulo n 3)) (pow2? (/ n 3))) n) (else (let ((lastfix (* 3 (expt 2 (A000523 (floor->exact (/ n 3))))))) (+ lastfix (A096114 (- (* 2 lastfix) n)))))))
%o A096114 (define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1)))))
%Y A096114 Inverse: A121664. Cf. A096111, A096113, A052330, A096116.
%K A096114 nonn
%O A096114 1,2
%A A096114 _Amarnath Murthy_, Jun 29 2004
%E A096114 Edited, extended and Scheme code added by _Antti Karttunen_, Aug 25 2006
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE