login
Inverse permutation A054582.
10

%I #30 May 01 2016 02:04:20

%S 1,2,3,4,6,5,10,7,15,9,21,8,28,14,36,11,45,20,55,13,66,27,78,12,91,35,

%T 105,19,120,44,136,16,153,54,171,26,190,65,210,18,231,77,253,34,276,

%U 90,300,17,325,104,351,43,378,119,406,25,435,135,465,53,496,152

%N Inverse permutation A054582.

%C Permutation of the natural numbers.

%C a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.

%H Boris Putievskiy, <a href="/A209268/b209268.txt">Table of n, a(n) for n = 1..10000</a>

%H Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations [of] Integer Sequences And Pairing Functions</a>, arXiv:1212.2732 [math.CO], 2012.

%H R. J. Mathar, <a href="http://oeis.org/wiki/User:R._J._Mathar/oeisPy/oeisPy/oeis_bulk.py">oeisPy

%H Eric W. Weisstein, <a href="http://mathworld.wolfram.com/PairingFunction.html">MathWorld: Pairing functions</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(n) = (((A003602)+A007814(n))^2 - A007814(n) + A003602(n))/2.

%F a(n) = ((x+y)^2-x+y)/2, where x = max {k: 2^k | n}, y = (n+2^x)/2^(x+1).

%e The start of the sequence for n = 1..32 as table, distributed by exponent of highest power of 2 dividing n:

%e | Exponent of highest power of 2 dividing n

%e n |--------------------------------------------------

%e | 0 1 2 3 4 5 ...

%e ------------------------------------------------------

%e 1 |....1

%e 2 |...........2

%e 3 |....3

%e 4 |..................4

%e 5 |....6

%e 6 |...........5

%e 7 |...10

%e 8 |..........................7

%e 9 |...15

%e 10 |...........9

%e 11 |...21

%e 12 |..................8

%e 13 |...28

%e 14 |..........14

%e 15 |...36

%e 16 |................................11

%e 17 |...45

%e 18 |..........20

%e 19 |...55

%e 20 |.................13

%e 21 |...66

%e 22 |..........27

%e 23 |...78

%e 24 |................................12

%e 25 |...91

%e 26 |..........35

%e 27 |..105

%e 28 |.................19

%e 29 |..120

%e 30 |..........44

%e 31 |..136

%e 32 |.........................................16

%e . . .

%e Let r_c be number row inside the column number c.

%e r_c = (n+2^c)/2^(c+1).

%e The column number 0 contains numbers r_0*(r_0+1)/2, A000217,

%e The column number 1 contains numbers r_1*(r_1+3)/2, A000096,

%e The column number 2 contains numbers r_2*(r_2+5)/2 + 1, A034856,

%e The column number 3 contains numbers r_3*(r_3+7)/2 + 3, A055998,

%e The column number 4 contains numbers r_4*(r_4+9)/2 + 6, A046691.

%t a[n_] := (v = IntegerExponent[n, 2]; (1/2)*(((1/2)*(n/2^v + 1) + v)^2 + (1/2)*(n/2^v + 1) - v)); Table[a[n], {n, 1, 55}] (* _Jean-François Alcover_, Jan 15 2013, from 1st formula *)

%o (Python)

%o f = open("result.csv", "w")

%o def A007814(n):

%o ### author Richard J. Mathar 2010-09-06 (Start)

%o ### http://oeis.org/wiki/User:R._J._Mathar/oeisPy/oeisPy/oeis_bulk.py

%o a = 0

%o nshft = n

%o while (nshft %2 == 0):

%o a += 1

%o nshft >>= 1

%o return a

%o ###(End)

%o for n in range(1,10001):

%o x = A007814(n)

%o y = (n+2**x)/2**(x+1)

%o m = ((x+y)**2-x+y)/2

%o f.write('%d;%d;%d;%d;\n' % (n, x, y, m))

%o f.close()

%Y Cf. A054582, A003602, A007814, A000217, A000096, A034856, A055998, A046691, A014132.

%K nonn

%O 1,2

%A _Boris Putievskiy_, Jan 15 2013