login
A163234
Inverse permutation to A163233.
4
0, 1, 2, 4, 6, 3, 11, 7, 9, 13, 5, 8, 24, 18, 17, 12, 28, 21, 37, 29, 10, 15, 16, 22, 58, 48, 47, 38, 31, 39, 23, 30, 35, 43, 27, 34, 62, 52, 51, 42, 14, 19, 20, 26, 32, 25, 41, 33, 112, 98, 97, 84, 73, 85, 61, 72, 70, 59, 83, 71, 40, 49, 50, 60, 120, 105, 137, 121, 78
OFFSET
0,3
FORMULA
a(n) = A001477bi(A006068(A059905(n)),A006068(A059906(n))), where A001477bi(x,y) = (((x+y)^2)+x+(3y))/2.
PROG
(Scheme:) (define (A163234 n) (A001477bi (A006068 (A059905 n)) (A006068 (A059906 n))))
(define (A001477bi x y) (/ (+ (expt (+ x y) 2) x (* 3 y)) 2))
(Python)
def A(x, y): return (((x + y)**2) + x + 3*y)//2
def a006068(n):
s=1
while True:
ns=n>>s
if ns==0: break
n=n^ns
s<<=1
return n
def a059905(n): return sum([(n>>2*i&1)<<i for i in range(int(len(bin(n)[2:])//2) + 1)])
def a059906(n):
x=[int(k) for k in list(bin(n)[2:])][::-1]
return sum([x[2*i + 1]*2**i for i in range(len(x)//2)])
def a(n): return A(a006068(a059905(n)), a006068(a059906(n)))
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 25 2017
CROSSREFS
Inverse: A163233. a(n) = A163236(A057300(n)). Cf. A163236.
Sequence in context: A108236 A002849 A329492 * A366111 A348022 A072984
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jul 29 2009
STATUS
approved