The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A254104 Permutation of natural numbers: a(0) = 0, a(3n) = 1 + 2*a(2n - 1), a(3n+1) = 1 + 2*a(2n), a(3n+2) = 2*a(n+1). 10
 0, 1, 2, 3, 5, 4, 7, 11, 6, 9, 15, 10, 23, 13, 8, 19, 31, 14, 21, 47, 22, 27, 17, 12, 39, 63, 18, 29, 43, 30, 95, 45, 20, 55, 35, 46, 25, 79, 26, 127, 37, 16, 59, 87, 38, 61, 191, 62, 91, 41, 28, 111, 71, 42, 93, 51, 94, 159, 53, 44, 255, 75, 54, 33, 119, 34, 175, 77, 24, 123, 383, 78, 125, 183, 126, 83, 57, 36, 223, 143, 58, 85, 187, 86, 103, 189, 60 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 LINKS Antti Karttunen, Table of n, a(n) for n = 0..9842 Index entries for sequences that are permutations of the natural numbers FORMULA a(0) = 0, a(3n) = 1 + 2*a(2n - 1), a(3n+1) = 1 + 2*a(2n), a(3n+2) = 2*a(n+1). Other identities: a(A007051(n)) = 2^n for all n >= 0. [A property shared with A064216.] PROG (Scheme, with memoizing macro definec) (definec (A254104 n) (cond ((< n 1) n) ((= 2 (modulo n 3)) (* 2 (A254104 (/ (+ n 1) 3)))) (else (+ 1 (* 2 (A254104 (+ -1 (inv_for_A032766 n)))))))) (define (inv_for_A032766 n) (+ (* 2 (floor->exact (/ n 3))) (modulo n 3))) (Python) def a(n): if n==0: return 0 if n%3==0: return 1 + 2*a(2*n//3 - 1) elif n%3==1: return 1 + 2*a(2*(n - 1)//3) else: return 2*a((n - 2)//3 + 1) print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 06 2017 CROSSREFS Inverse: A254103. Cf. A007051, A016789, A032766, A064216, A253887. Sequence in context: A347204 A114461 A065578 * A126918 A250472 A291588 Adjacent sequences: A254101 A254102 A254103 * A254105 A254106 A254107 KEYWORD nonn AUTHOR Antti Karttunen, Jan 25 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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified August 9 10:37 EDT 2024. Contains 375040 sequences. (Running on oeis4.)