A perfect shuffle (or [https://en.wikipedia.org/wiki/Faro_shuffle faro/weave shuffle]) means splitting a deck of cards into equal halves, and perfectly interleaving them - so that you end up with the first card from the left half, followed by the first card from the right half, and so on:
:::
J♠ Q♠ K♠
'''''The Task'''''
# Write a function that can perform a perfect shuffle on an even-sized list of values. # Call this function repeatedly to count how many shuffles are needed to get a deck back to its original order, for each of the deck sizes listed under "Test Cases" below. #* You can use a list of numbers (or anything else that's convenient) to represent a deck; just make sure that all "cards" are unique within each deck. #* Print out the resulting shuffle counts, to demonstrate that your program passes the test-cases.'''''Test Cases'''''
::::: {| class="wikitable" |- ! input ''(deck size)'' !! output ''(number of shuffles required)'' |- | 8 || 3 |- | 24 || 11 |- | 52 || 8 |- | 100 || 30 |- | 1020 || 1018 |- | 1024 || 10 |- | 10000 || 300 |}