Execute a Superb Shuffle™

Ruby, 31 bytes

->x{(0..53).map{|r|x[r*17%54]}}

Try it online!

Explanation:

I'm picking one card, then skipping over the next 16 and start from the first card when I reach the last card of the deck. 17 and 54 are mutually prime, so I'm sure to pick all cards.

The 17th position is guaranteed to be a different suit and the difference in value is at least 2: the 13th (or 15th) card has the same value and a different suit, so by skipping other 4 (or 2), the value is right.


Python 3, 21 bytes

lambda x:(x*17)[::17]

Try it online!

Explanation:

The same idea as my Ruby answer, but even shorter in Python: I use 17 decks, and pick every 17th card.


Japt, 6 5 4 bytes

Splits the input array into sub-arrays of every 16th element and flattens.

óG c

Try it