login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A194280 Inverse permutation to A081344. 7
1, 2, 5, 3, 6, 9, 13, 8, 4, 7, 12, 18, 25, 19, 14, 10, 15, 20, 26, 33, 41, 32, 24, 17, 11, 16, 23, 31, 40, 50, 61, 51, 42, 34, 27, 21, 28, 35, 43, 52, 62, 73, 85, 72, 60, 49, 39, 30, 22, 29, 38, 48, 59, 71, 84, 98, 113 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Permutation of the natural numbers.
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.
Call a "layer" a pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). This sequence is A188568 as table read layer by layer clockwise.
The same table A188568 read by boustrophedon ("ox-plowing") method - layer clockwise, layer counterclockwise and so on - is A064790. - Boris Putievskiy, Mar 14 2013
LINKS
Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
FORMULA
a(n) = (i+j-1)*(i+j-2)/2+j, where
i = mod(t;2)*min{t; n - (t - 1)^2} + mod(t + 1; 2)*min{t; t^2 - n + 1}
j = mod(t;2)*min{t; t^2 - n + 1} + mod(t + 1; 2)*min{t; n - (t - 1)^2},
t = int(math.sqrt(n-1))+1.
EXAMPLE
From Boris Putievskiy, Mar 14 2013: (Start)
The start of the sequence as table:
1....2...6...7..15..16..28...
3....5...9..12..20..23..35...
4....8..13..18..26..31..43...
10..14..19..25..33..40..52...
11..17..24..32..41..50..62...
21..27..34..42..51..61..73...
22..30..39..49..60..72..85...
...
The start of the sequence as triangular array read by rows:
1;
2,5,3;
6,9,13,8,4;
7,12,18,25,19,14,10;
15,20,26,33,41,32,24,17,11;
16,23,31,40,50,61,51,42,34,27,21;
28,35,43,52,62,73,85,72,60,49,39,30,22;
...
Row number r contains 2*r-1 numbers. (End)
PROG
(Python)
t=int(math.sqrt(n-1))+1
i=(t % 2)*min(t, n-(t-1)**2) + ((t+1) % 2)*min(t, t**2-n+1)
j=(t % 2)*min(t, t**2-n+1) + ((t+1) % 2)*min(t, n-(t-1)**2)
m=(i+j-1)*(i+j-2)/2+j
CROSSREFS
Sequence in context: A359008 A239970 A111202 * A163362 A243061 A242911
KEYWORD
nonn
AUTHOR
Boris Putievskiy, Dec 23 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 06:49 EDT 2024. Contains 371964 sequences. (Running on oeis4.)