login
A264996
Self-inverse permutation of natural numbers: a(n) = (1/2) * (1+A263273(2n -1)) = 1 + A264985(n-1).
5
1, 2, 4, 3, 5, 10, 7, 11, 13, 6, 8, 12, 9, 14, 28, 19, 29, 37, 16, 20, 34, 25, 32, 31, 22, 38, 40, 15, 17, 33, 24, 23, 30, 21, 35, 39, 18, 26, 36, 27, 41, 82, 55, 83, 109, 46, 56, 100, 73, 86, 91, 64, 110, 118, 43, 47, 97, 70, 59, 88, 61, 101, 115, 52, 74, 106, 79, 95, 85, 58, 92, 112, 49, 65, 103, 76
OFFSET
1,2
FORMULA
a(n) = (1/2) * (1+A263273((2*n)-1)).
a(n) = 1 + A264985(n-1).
MATHEMATICA
f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; Array[(1/2) (1 + f[2 # - 1]) &, {76}] (* Michael De Vlieger, Jan 04 2016, after Jean-François Alcover at A263273 *)
PROG
(Scheme, two alternatives)
(define (A264996 n) (/ (+ 1 (A263273 (+ n n -1))) 2))
(define (A264996 n) (+ 1 (A264985 (- n 1))))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Jan 04 2016
STATUS
approved