I created a random permutation with a deck of 52 unique cards. I want to transform this random permutation into a number that is represented in binary format with a length of $\lfloor \log_2(52!))\rfloor$. Is that possible and how can I do that?
2026-04-14 11:21:47.1776165707
Creating binary information from a permutation
468 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in PERMUTATIONS
- A weird automorphism
- List Conjugacy Classes in GAP?
- Permutation does not change if we multiply by left by another group element?
- Validating a solution to a combinatorics problem
- Selection of at least one vowel and one consonant
- How to get the missing brick of the proof $A \circ P_\sigma = P_\sigma \circ A$ using permutations?
- Probability of a candidate being selected for a job.
- $S_3$ action on the splitting field of $\mathbb{Q}[x]/(x^3 - x - 1)$
- Expected "overlap" between permutations of a multiset
- Selecting balls from infinite sample with certain conditions
Related Questions in ALGORITHMS
- Least Absolute Deviation (LAD) Line Fitting / Regression
- Do these special substring sets form a matroid?
- Modified conjugate gradient method to minimise quadratic functional restricted to positive solutions
- Correct way to prove Big O statement
- Product of sums of all subsets mod $k$?
- (logn)^(logn) = n^(log10+logn). WHY?
- Clarificaiton on barycentric coordinates
- Minimum number of moves to make all elements of the sequence zero.
- Translation of the work of Gauss where the fast Fourier transform algorithm first appeared
- sources about SVD complexity
Related Questions in FACTORIAL
- How is $\frac{\left(2\left(n+1\right)\right)!}{\left(n+1\right)!}\cdot \frac{n!}{\left(2n\right)!}$ simplified like that?
- Remainder of $22!$ upon division with $23$?
- What is the name of this expression?
- How to compute $\left(\frac{n-1}{2}\right)!\pmod{n}$ fast?
- Proving $\sum_{k=1}^n kk!=(n+1)!−1$
- How do we know the Gamma function Γ(n) is ((n-1)!)?
- Approximate value of $15!$
- Limit of a Sequence involving factorials
- How to understand intuitively the fact that $\log(n!) = n\log(n) - n + O(\log(n))$?
- Deriving the fact that the approximation $\log(n!) \approx n\log(n) - n + \frac{1}{2}\log(2\pi n)$ is $O(1/n)$.
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
There is an explicit mapping of $n$-permutations to integers in $[0,n!-1]$. Before turning to permutations, recall that usual base $b$ representation works as follows:
Take a sequence of natural numbers $b_k\geqslant 2$. Then each natural number $n\in\Bbb N_0$ has a unique representation of the form $$n=\sum_{k=0}^\infty a_k B_k\qquad\text{where}\quad 0\leqslant a_k< b_k,\ B_k=\prod_{i=0}^{k-1}b_i $$ where the integers $a_k$ are unique integers called "digits" and only finitely many $a_k$ are non-zero. The empty product shall be $1$, i.e. $B_0=1$.
The common use case is when all $b_i=b$ are the same, for example $b=2$ for binary representation or $b=10$ for decimal representation. The $a_i$ are the digits of $n$ represented in base $b$, and $B_k=b^k$ is the magnitude of the $k$-th digit $a_k$.
But we can as well pick a sequence of different natural numbers for $b_i$, in particular we can pick $b_i=i+1$. Notice that $b_0=1$ is no problem provided infinitely many $b_i$'s satisfy $b_i\geqslant2$. This choice of $b_i$ gives again a unique representation of $n\in\Bbb N_0$ with digits $0\leqslant a_k \leqslant k$ and $B_k=k!$, $k\geqslant0$.
Now on one hand, this gives a unique representation of natural numbers, and on the other hand, a number with $j$ digits gives a natural representation of a $j$-permutation as follows: Suppose we have a list of $j$ items, then pick the $a_j$-th item and then remove that item from the list. Proceed with $a_{j-1}$ etc. until all items are consumed and the list is empty. The items in the list are indexed starting at zero.
Example: Take $$n=13= 2\cdot 3! + 0\cdot2! + 1\cdot 1!+0\cdot0!$$ with the 4 digits
2010from hihgest to lowest. The list of items beABCD. The rule is to first pick element no. 2, which isCas counting starts at 0:To be more explicit, here is a Python3 code that converts integers to FAK representations and vice versa. The returned FAK is little endian, i.e. the $k$-th entry (digit) satisfies $0\leqslant a_k \leqslant k$ where $k$ starts at 0:
Notice that it's easy to implement addition and subtraction on this format. Just add digits starting at the $0$-th and work towards higher digits applying carry from lower digits. In particular, one can implement increment by one to get to the "next" permutation without the need to convert from ints again and again.
The little endian FAKs can then act as permutations on
tuples,lists orstrings:The inverse function is retrieving a FAK from a given permutation and an unpermuted set of objects:
Finally, here is some code and produced output. The base set is called
Alphabetin the code, and for brevity it has only 10 elements:Here is the output:
Notice that the last int value is the largest you can get for a 10-permutation, which is $$10!-1 = \sum_{k=0}^{10-1} k\cdot k!$$
As a final note, you'll need 1 bit more than you calculated, though, because the number of bits needed to encode a natural number $n$ in the usual way and without sign is $1+\lfloor\log_2n\rfloor$ bits. In particular, to encode $0,\cdots, 52!-1$ you'll need $$226 =1+\lfloor\log_2(52!-1)\rfloor\text{ bits}$$ or 68 decimals places.