|
|
A246210
|
|
Permutation of nonnegative integers: a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 1 + 2*a(-(A117966(n))), otherwise a(n) = 2*a(A117966(n)-1).
|
|
5
|
|
|
0, 1, 3, 6, 12, 2, 13, 7, 25, 50, 100, 14, 28, 56, 200, 4, 26, 24, 101, 51, 201, 27, 5, 15, 57, 29, 113, 226, 452, 58, 116, 232, 904, 30, 114, 10, 20, 40, 228, 456, 912, 80, 1808, 60, 464, 48, 202, 52, 402, 54, 102, 400, 8, 112, 453, 227, 905, 115, 31, 59, 233, 117, 465, 203, 49, 103, 9, 401, 53, 55, 403, 11, 41, 21, 81, 61
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
This is an instance of entanglement permutation, where complementary pair A117967/A117968 (positive and negative part of inverse of balanced ternary enumeration of integers, respectively) is entangled with complementary pair A005843/A005408 (even and odd numbers respectively), with a(0) set to 0 and a(1) set to 1.
This implies that apart from a(1) = 1, even numbers occur only in positions given by A117967, and odd numbers only in positions given by A117968.
|
|
LINKS
|
|
|
FORMULA
|
a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 1 + 2*a(-(A117966(n))), otherwise a(n) = 2*a(A117966(n)-1).
As a composition of related permutations:
|
|
PROG
|
(Scheme, with memoizing definec-macro from Antti Karttunen's IntSeq-library)
(Python)
def a117966(n):
if n==0: return 0
if n%3==0: return 3*a117966(n//3)
elif n%3==1: return 3*a117966((n - 1)//3) + 1
else: return 3*a117966((n - 2)//3) - 1
def a(n):
if n<2: return n
x=a117966(n)
if x<1: return 1 + 2*a(-x)
else: return 2*a(x - 1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|