by qsort · 2y ago · 0 comments
Shouldn't be too hard to do even with pen and paper since the 2-adic eval of 52! is large.
If you factor the number 52! (https://wolframalpha.com/input?i=factor+52%21), you can see the term 2^49. If you divide 52! by two 49 times, you are still left with an integer.
[1]: 52 factorial, 52*51*50*...*2*1, the number of different orderings of the 52 cards in a standard deck
The 2-adic valuation of a number is the largest number of times you can divide it by 2 and still get an integer.
https://math.stackexchange.com/questions/434931/elementary-q...Could you elaborate?
It's nothing fancy, get the prime power decomposition of your number and pick the exponent of p.
There's a clever way to do that for a factorial, but I have the Pari/GP app on my phone so I just did:
valuation(52!,2)
which gives the answer 49, so 52! is divisible by 2 forty-nine times. Interestingly chatgpt4 turbo got it right with no extra prodding needed.My calculator says 225 bits, and text suggests the same. Looks like chatgpt4 was wrong as usual:)
For just 52 for example 2 is a prime factor twice, because (52/2)/2 = 13, which is no longer divisible by 2.
Or in other words 52! / (2^49) is an integer, but 52! / (2^50) is not, thus 49 is the correct answer.
Could I recommend phrasing this kind of comment as a question in future? (Notwithstanding the lifehack of making a false statement in the internet being the shortest path to an answer.)
If you wanted to turn this into an actual protocol, you would presumably flag some permutations as invalid and use the other ones. You would then encode one bit at a time doing a binary search of the set of valid permutations.
Because 52! has a large number of 2s in its factorization, for a careful choice of the valid permutations it should be practical (or at least not significantly more impractical than the OP's proposed method) to perform this by hand because you would be able to "eyeball" most splits of the binary search.