

A163241


Simple selfinverse permutation: Write n in base 4, then replace each digit '2' by '3' and vice versa, then convert back to decimal.


9



0, 1, 3, 2, 4, 5, 7, 6, 12, 13, 15, 14, 8, 9, 11, 10, 16, 17, 19, 18, 20, 21, 23, 22, 28, 29, 31, 30, 24, 25, 27, 26, 48, 49, 51, 50, 52, 53, 55, 54, 60, 61, 63, 62, 56, 57, 59, 58, 32, 33, 35, 34, 36, 37, 39, 38, 44, 45, 47, 46, 40, 41, 43, 42, 64, 65, 67, 66, 68, 69, 71, 70
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


LINKS

A. Karttunen, Table of n, a(n) for n = 0..1023
Index entries for sequences that are permutations of the natural numbers


FORMULA

a(n) = A000695(A003987bi(A059905(n),A059906(n))) + 2*A000695(A059906(n)), where A003987bi is binary XOR.


EXAMPLE

43 in quaternary base (A007090) is written as '223' (2*16 + 2*4 + 3), which is then mapped to '332' = 3*16 + 3*4 + 2 = 62, thus a(43) = 62, and likewise a(62) = 43.


MATHEMATICA

Table[FromDigits[IntegerDigits[n, 4]/.{2>a, 3>b}/.{a>3, b>2}, 4], {n, 0, 75}] (* Harvey P. Dale, Nov 29 2011 *)


PROG

(Scheme) (define (A163241 n) (+ (A000695 (A003987bi (A059905 n) (A059906 n))) (* 2 (A000695 (A059906 n)))))


CROSSREFS

Cf. A048647, A007090, A003987.
Sequence in context: A117123 A116966 A182187 * A234027 A165279 A125060
Adjacent sequences: A163238 A163239 A163240 * A163242 A163243 A163244


KEYWORD

nonn,base,easy


AUTHOR

Antti Karttunen, Jul 29 2009


EXTENSIONS

Edited by Charles R Greathouse IV, Nov 01 2009


STATUS

approved



