The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A368783 Lexicographic rank of the permutation which is the Eytzinger array layout of n elements. 0
0, 0, 1, 2, 15, 82, 402, 2352, 22113, 220504, 2329650, 26780256, 293266680, 3505934160, 45390355920, 633293015040, 10873520709273, 195823830637744, 3698406245739330, 73192513664010816, 1509611621730135000, 32576548307761013760, 734272503865161846480 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
The Eytzinger array layout arranges elements so that a binary search can be performed starting at element k=1 and at a given k step to 2*k or 2*k+1 according as the target is smaller or larger than the element at k.
The lexicographic rank of a permutation of n elements is its position in the ordered list of all possible permutations of n elements, and here taking the first permutation as rank 0.
LINKS
sympy.org, Permutation rank
PROG
(Python)
from sympy.combinatorics.permutations import Permutation
def a(n):
def eytzinger(t, k=1, i=0):
if (k < len(t)):
i = eytzinger(t, k * 2, i)
t[k] = i
i += 1
i = eytzinger(t, k * 2 + 1, i)
return i
t = [0] * (n+1)
eytzinger(t)
return Permutation(t[1:]).rank()
print([a(n) for n in range(0, 24)])
CROSSREFS
Sequence in context: A036239 A268735 A215705 * A301566 A109725 A057152
KEYWORD
nonn
AUTHOR
Darío Clavijo, Feb 15 2024
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 May 15 05:46 EDT 2024. Contains 372538 sequences. (Running on oeis4.)