login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A269397
Permutation of natural numbers: a(1) = 1, a(A233271(1+n)) = A179016(1+a(n)), a(A269390(n)) = A213713(a(n)), where A179016, A233271 are the infinite trunks of binary beanstalk and inverted binary beanstalk and A213713, A269390 their complements.
4
1, 3, 2, 7, 6, 5, 4, 16, 13, 12, 10, 15, 9, 27, 11, 8, 22, 21, 18, 25, 46, 17, 43, 35, 20, 14, 36, 32, 34, 29, 26, 42, 40, 69, 28, 65, 54, 23, 33, 24, 55, 85, 50, 52, 45, 31, 41, 62, 19, 60, 100, 44, 67, 95, 80, 64, 37, 51, 38, 53, 82, 122, 78, 158, 75, 77, 68, 48, 61, 91, 49, 30, 88, 143, 145, 66, 98, 136, 116, 115, 93, 63, 56, 76, 58, 79, 39
OFFSET
1,2
FORMULA
a(1) = 1, for n > 1, if A269381(n) - A269381(n-1) > 0 [when n is in A233271] a(n) = A179016(1+a(A269381(n)-1)), otherwise a(n) = A213713(a(n-A269381(n))).
As a composition of related permutations:
a(n) = A269402(A269391(n)).
PROG
(Scheme, with memoization-macro definec)
(definec (A269397 n) (cond ((<= n 1) n) ((zero? (- (A269381 n) (A269381 (- n 1)))) (A213713 (A269397 (- n (A269381 n))))) (else (A179016 (+ 1 (A269397 (+ -1 (A269381 n))))))))
CROSSREFS
Inverse: A269398.
Related or similar permutations: A269391, A269401, A269402.
Cf. also A233270.
Sequence in context: A276343 A054429 A269398 * A267107 A126316 A101224
KEYWORD
nonn,base,look
AUTHOR
Antti Karttunen, Mar 05 2016
STATUS
approved