The Magic Café
Username:
Password:
[ Lost Password ]
  [ Forgot Username ]
The Magic Cafe Forum Index » » Magical equations » » Shuffling with Wolfram|Alpha (0 Likes) Printer Friendly Version

Scott Cram
View Profile
Inner circle
2677 Posts

Profile of Scott Cram
After working with Michael Daniels' question, I started wondering if it was possible to get Wolfram|Alpha to faro shuffle.

After a little playing around, I got it to work!

In the formulas to which I link, there are two variables, x and y.

y = the total number of cards involved in the shuffle
x = the individual positions of the cards, from 1 up to the y (again, the total number of cards)

The only variable you need to alter is the total number of cards. Look for the following section in the search bar:
{y, 52, 52}

As it's written, it's telling Wolfram|Alpha that you want the number of cards to range from 52 to 52.

If you want a different number of cards, just change both 52s to that number. For example, if you want to use 14 cards instead, you would change it to read:
{y, 14, 14}

Here's the out-faro formula.

In the link above, it give the following result:
{{1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52}}

What does this mean? It means that the card that was originally located at postion 1 is still at position 1, the card originally at position 2 is at position 3 after the shuffle, and so on, up to the original 51st card being at position 50 after the shuffle, and 52 staying where it is.

The out-faro formula can be used with any number of cards, odd or even. If you're doing an out-faro with an odd number of cards, the formula assumes that you're talking the larger portion of cards into your right hand. For example, a 51-card out-faro would be done by taking 26 cards above the break (into the right hand), and leaving 25 cards below the break (in the left hand).

Alternatively, Here's the in-faro formula.

At the above link, you'll get these results, which are read in the same way as the previous results:
{{2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51}}

The original top card is now second, the original 2nd card is now 4th, and so on, down to the original 52nd card now being in position 51.

This formula can also be used with any number of cards, odd or even. However, the in-faro formula assumes that, if you're using an odd number of cards, you're taking the smaller portion into your right hand and leaving the larger portion in your left hand (the exact opposite of the out-faro formula above).

So, if you run an in-faro with 51 cards, it assumes you're taking 25 cards above the break (into your right hand), and leaving 26 cards below the break (in your left hand).

I just thought I'd post this, and see if any one finds this interesting or useful. As there's already so much written on 52-card faro shuffles, you'll probably find this more useful for trying out decks of other sizes.

Any thoughts?
hcs
View Profile
Elite user
Germany, Magdeburg
471 Posts

Profile of hcs
Amazing! I'm deeply impressed.
Melencolia I - Magic Squares for the Mental Entertainer * Smart Methods for 4x4, 5x5 and 6x6 Magic Squares * 180 A4-pages * version 3.51
Michael Daniels
View Profile
Inner circle
Isle of Man
1546 Posts

Profile of Michael Daniels
Brilliant Scott! - this is an incredibly useful resource.

Mike
Scott Cram
View Profile
Inner circle
2677 Posts

Profile of Scott Cram
Thanks!

I've been playing around with it a bit more, simplified the formula, and combined both into a single formula.

Here's the new version of the formula.

This one should be much clearer and easier to use.

Before the formula, you see 2 variables now, like this:
z=1, y=52

As before, y is the total number of cards you wish to shuffle.

The new variable z is either 1 or 0. Set z=1 if you desire an in-faro, or set z=0 if you desire an out-faro.

This coding is almost its own mnemonic: 1 looks like I, which stands for In-faro, and 0 looks like O, which stands for Out-faro.

The link above is great, if you want to see and understand the formula.

However, if you'd rather focus on just putting your variables in and seeing the results, its easier to just use my Faro Shuffler Wolfram|Alpha widget.

Play close attention to the description: Track cards after a faro shuffle. (Note on using odd numbers of cards: Widget assumes in-faros are split with 1 less card ABOVE the break, and out-faros are split with 1 less card BELOW the break.)

With even numbers, of course, it assumes the cards are split evenly.
Scott Cram
View Profile
Inner circle
2677 Posts

Profile of Scott Cram
You can use the results to see how the cards change through multiple shuffles (as long as you assume a sequence of all in-faros or all out-faros), as well.

Running the widget so as to out-faro 10 cards, and you get this result:
{1, 3, 5, 7, 9, 2, 4, 6, 8, 10}

It's probably easier to read this way (pre-shuffle position on the left, post-shuffle position on the right):
1 |1
2 |3
3 |5
4 |7
5 |9
6 |2
7 |4
8 |6
9 |8
10|10

Let's follow the paths of each card:
1 (stays at 1)
2, 3, 5, 9, 8, 6 (back to 2)
4, 7 (back to 4)
10 (stays at 10)

The longest sequence here is 6 steps long, so obviously it will take 6 out-faros to restore the original order of the cards.

With an even number of cards given an out-faro, it's no surprise that 1 and 10 remain where they are, but that oscillation of the 4th card to the 7th position is interesting. Who knows? There may be a trick there.

Wondering about reverse faros? Just reverse the way you read the chart above!

If we want to start with 2, where is 2 on the right? Next to the 6! We find a 6 on the right next to the 8, and so on, so the reverse out-faros (top card remains top card throughout) result in these sequences:
1 (stays at 1)
2, 6, 8, 9, 5, 3 (back to 2)
4, 7 (back to 4)
10 (stays at 10)
TomasB
View Profile
Inner circle
Sweden
1144 Posts

Profile of TomasB
Great, Scott!

Thanks,

/Tomas
The Magic Cafe Forum Index » » Magical equations » » Shuffling with Wolfram|Alpha (0 Likes)
[ Top of Page ]
All content & postings Copyright © 2001-2022 Steve Brooks. All Rights Reserved.
This page was created in 0.16 seconds requiring 5 database queries.
The views and comments expressed on The Magic Café
are not necessarily those of The Magic Café, Steve Brooks, or Steve Brooks Magic.
> Privacy Statement <

ROTFL Billions and billions served! ROTFL