The Magic Caf
[ Lost Password ]
  [ Forgot Username ]
The Magic Cafe Forum Index » » Magical equations » » Need ternary 4 bit deBruijn wrap 52 (1 Likes) Printer Friendly Version

View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Need ternary 4 bit deBruijn
I need a ternary 4 bit unique for 52 bits that cycles back to the first bit. I plan to use three bicycle deck types (rider, maiden, mandolin) to do "eyes closed if red" type deBruijn trick without the equivocate "closing their eyes" and not based on red cards therefore instead of two bits have 3 bit types (not just 0 and 1 instead have 0, 1, 2) and 4 occurrences in the string which would yield 3x3x3x3 = 81 which is more than enough to cover 52 cards. Next is to develop this specialized ternary (not binary) debruin string ie 11110000222200110220102.... etc.

The reason for this special deBruijn is I want to cut the number of selected consecutive cards down from six to four. This way I will have just four people on stage instead of six. Also I could easily do the trick close up with just two people that each have two cards (one in each hand). I also want to use a full 52 card deck (no repeating cards).

I plan to use this in conjunction with a mem deck (four cards taken in sequence) and have a crib card to reference for the different 4-bit patterns, and once I determine the first of the four cards based on that pattern I will know the other 3 cards because I have the whole deck memorized. Just think of this 52 tri bit 4 bit pattern as overlaying the mem deck cards so that each card has a unique 4-bit pattern.

Let's say rider back = 0, maiden back = 1, mandolin back = 2. You get the idea. It's kind of like having marked cards without having any marks and the magician can read the pattern from a great distance. I could use one way backs but there is always the danger that a spectator may rotate their card 180 degrees. I've seen examples on the internet of the six-bit version done with two different color cards (red and blue) but that is obvious to spectators in the know. By using three very similar backed cards the spectators should not know and they can look at their individual card and find no secret markings.

I think there are some of you out there that have software that could give me the appropriate ternary deBruijn sequence. tomasB, jmbulg, claudio, others, your help is much appreciated!
Thanks. Larfin glowball
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
I played around with some hodgepodge numbers (did manually, no computer) and had to do some tweaking and finally came up with the following sequence:


Above is broken down into the below 52 patterns and I moved it to a spreadsheet and sorted them as text so it was easy to spot any duplicates and I double checked twice and there are no duplicates! Therefore it is a good trenary 4 bit 52 deBruijn wrapping sequence to overlay on a mem stack and then use rider backs in the zeros positions, maiden backs in the ones positions, and mandolin backs in the twos positions. Next I'll make a cheat sheet for my Aronson stack and post it below. I'll make one up for the Tamariz stack and post it also.




View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
In case I don't get around to posting the Tamariz and Aronson cheat sheets (I'll be 79 next month) Below are instructions on how to do it for any memorized stack:

The way you make a cheat sheet is first list 4 bit patterns from my prior post into column A of a spreadsheet program such as Google sheets or Excel. example:
1111 Will be in cell A1
1110 Will be in cell A2
1100 will be in cell A3
and so on until you have 52 cells filled in.
Next in the B column of the same spreadsheet you type in each card of your mem stack.
example for Tamariz:
4C will be in cell B1
2H will be in cell B2
7D will be in cell B3
and so on until you have 52 entries in the B column.
next copy the A column to the C column then copy the B column to the D column.

Make sure all 4 of these columns are defined as text before you do any of this.

Next use column C as your sort column (ascending) but specify that column C and D Will move together. If you are not familiar with spreadsheet commands just ask someone who is familiar, this is very easy to do.

After sorting columns C and D highlight the 52 cells in column C and D and then print them off. This is your cheat/crib sheet.

The sorting allows you to quickly find the pattern you see on the four cards otherwise you might have to visually scan nearly all 52 rows to find your pattern.

Tamariz example if I see the pattern Maiden, Maiden, Rider, Rider I mentally translate that to 1100 and look down on my cheat sheet and see just to the right of 1100 is 7D therefore I know all four cards the spectators are holding.

For an Aronson cheat sheet that same pattern would mean 1100 is 5C etc.

For Tamariz if you see the pattern: mandolin, mandolin, rider, maiden that translates to 2201 which on the Tamariz cheat sheet would show 2201 is 2C (the 27th card in the stack).
View Profile
Inner circle
1757 Posts

Profile of Claudio
Hi Larfin,

I haven't had time yet to digest what you posted but it looks promising.

Meanwhile, here's a link about the DeBruijn Card trick from Grey Matters which has a few interesting links as well on a 4bit method. I suggest you read the Grey Matters article before watching the video which has an error.

PS: Congrats on soon reaching 79!!
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Claudio, thanks, I've had my two shots and my booster and I just got over a mild case of covid. For last 3 years I have eaten strictly plant-based and whole foods and my health numbers have become excellent so hopefully I'll be around a while to do some more postings.

Yes several years ago I had seen James Grime (YouTube name: singingbanana) video using four bit based binary deBruijn and 16 cards but I had not read that particular gray matters article that you referenced and it's pretty cool the way they used mnemonics to remember the binary patterns, so thanks again.

Before I started this thread I had planned to use James' deBruijn wrapping pattern 1111000010011010 to make up a deck of 8 riders and 8 maidens (the maidens would be in the ones position because they have a little more vertical narrow white area and look somewhat like the number one). Then of course I will duplicate those 16 cards two more times giving 48 cards.

Everything has pros and cons and my thoughts about James' 4 bit 16 times 3 binary deck versus my ternary 4 bit 52 deBruijn deck are as follows:

James 4 bit 16 times 3 binary deck:

pros: only 16 patterns so you can use mnemonics much easier to remember the patterns, also with only 16 cards then it's also easier to memorize the cards and have a simple scheme and not need a cheat sheet

cons: when showing the deck face up it must be very brief, also at the end of the trick the deck cannot be examined, you must phish to get the pattern ("who has red cards")

Larfin glowball 4 bit ternary 52 deck using rider, maiden, mandolin cards:

pros: whole deck can be spread face up and looked at by the spectators, can use with an existing mem deck (Aronson, Tamariz etc), no phishing is done, the pattern can be read from a considerable distance, easy to set up since the magician has the 52 cards memorized

cons: requires the use of a cheat sheet to tie the 52 patterns to each card (cheat sheet could be printed on the ad cards), the backs of the cards cannot be scrutinized together however an individual card held by a spectator can be scrutinized.

I plan on making up both decks but for James deck I plan on using riders and maidens and thus don't have to phish for red cards and I plan to use the first 16 cards from a mem (in my case Aronson) deck (times 3) and use a simple 16 row cheat sheet on the back of an ad card.

I've got a couple of magic club meetings coming up so I'll try both decks and see how it goes over.

Later I may simply try to memorize each of the 52 patterns onto my Aronson cards and thus eliminate the need for a cheat sheet when using my ternary deck.
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Ternary 4 Bit (4 card) Sorted Aronson Cheat Sheet
0000 - 9S
0001 - 2D
0002 - AS
0011 - KD
0012 - 6D
0020 - 8H
0022 - 3H
0102 - 3D
0110 - JH
0111 - 7D
0112 - 9H
0121 - QC
0122 - 4H
0200 - 9C
0201 - 3C
0210 - 4S
0220 - QH
0222 - 6C
1000 - 2H
1011 - JC
1020 - 6H
1021 - JD
1022 - 7H
1100 - 5C
1102 - TC
1110 - KC
1111 - JS
1112 - 8C
1120 - KS
1122 - 3S
1200 - 6S
1201 - AH
1211 - 2C
1221 - KH
1222 - AD
2000 - 5H
2001 - QS
2002 - 4C
2010 - 8S
2011 - 2S
2012 - 7C
2101 - TD
2102 - TH
2111 - 9D
2120 - QD
2200 - TS
2201 - 5D
2210 - 4D
2212 - 5S
2220 - AC
2221 - 7S
2222 - 8D

Note that the 4 card pattern reveals the first card of the four.

Note that this whole ternary based magic trick is useless without a cheat sheet.
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Tamariz cheat sheet.
Ternary 4 bit (4 card) 52 sorted Tamariz cheat sheet:

Tam 0000 - 4H
Tam 0001 - QC
Tam 0002 - 6D
Tam 0011 - 8H
Tam 0012 - TD
Tam 0020 - QD
Tam 0022 - AS
Tam 0102 - TC
Tam 0110 - TS
Tam 0111 - 6S
Tam 0112 - 4D
Tam 0121 - 6C
Tam 0122 - 8D
Tam 0200 - 7C
Tam 0201 - 4S
Tam 0210 - 7S
Tam 0220 - KD
Tam 0222 - 5H
Tam 1000 - 3C
Tam 1011 - 8C
Tam 1020 - AD
Tam 1021 - JC
Tam 1022 - 5D
Tam 1100 - 7D
Tam 1102 - KH
Tam 1110 - 2H
Tam 1111 - 4C
Tam 1112 - 5S
Tam 1120 - AC
Tam 1122 - 9H
Tam 1200 - 9C
Tam 1201 - 8S
Tam 1211 - AH
Tam 1221 - 5C
Tam 1222 - KC
Tam 2000 - 3D
Tam 2001 - QS
Tam 2002 - JS
Tam 2010 - 6H
Tam 2011 - 7H
Tam 2012 - 3H
Tam 2101 - JD
Tam 2102 - TH
Tam 2111 - 9D
Tam 2120 - 3S
Tam 2200 - QH
Tam 2201 - 2C
Tam 2210 - KS
Tam 2212 - JH
Tam 2220 - 2S
Tam 2221 - 2D
Tam 2222 - 9S

Note that the four card pattern reveals the first card of the four.

Note that the first digit designates the type of back design for the card.

Example "0122 - 8D" the first digit in this case "0" means the 8 of diamonds must be a RIDER backed card (for a Tamariz deck).

Note in the above example spectator one is holding a rider back, spectator two is holding a maiden back, spectator three is holding a mandolin back, spectator four is holding a mandolin back. This signals that spectator one is holding the eight of diamonds.

Example "1021- JC" the first digit in this case "1" means the Jack of clubs must be a MAIDEN backed card (for a Tamariz deck).

Example "2120 - 3S" the first digit in this case "2" means the three of spades must be a MANDOLIN backed card (for a Tamariz deck).
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
I'm making a very slight change to my ternary sequence. Position 36 changed from a "1" to a "2". Normally you cannot change a deBruin sequence number willy-nilly because you will create duplicate patterns (a duplicate pattern is a bad thing, means that it's not a true deBruijn). I lucked out because it is still a true "no duplicate" four bit sequence. The reason for this change is that the old sequence had a total of 18 zeros, 17 ones, 17 twos but I want a breakdown of 18 zeros, 16 ones, 18 twos because of future possibilities that I won't get into here.

This is the new better ternary wrapping deBruijn with the 36th bit changed to a 2:

Because of this small change I will replace the maiden back Jack of diamonds (in Aronson deck position 36) with a mandolin back Jack of diamonds and create a better sorted Aronson cheat sheet (see below):

Better Aronson Sorted Ternary Cheat Sheet:
Aron 0000 - 9S
Aron 0001 - 2D
Aron 0002 - AS
Aron 0011 - KD
Aron 0012 - 6D
Aron 0020 - 8H
Aron 0022 - 3H
Aron 0102 - 3D
Aron 0111 - 7D
Aron 0112 - 9H
Aron 0120 - JH
Aron 0121 - QC
Aron 0122 - 4H
Aron 0200 - 9C
Aron 0201 - 3C
Aron 0210 - 4S
Aron 0220 - QH
Aron 0222 - 6C
Aron 1000 - 2H
Aron 1012 - JC
Aron 1020 - 6H
Aron 1022 - 7H
Aron 1100 - 5C
Aron 1110 - KC
Aron 1111 - JS
Aron 1112 - 8C
Aron 1120 - KS
Aron 1122 - 3S
Aron 1200 - 6S
Aron 1201 - AH
Aron 1202 - TC
Aron 1211 - 2C
Aron 1221 - KH
Aron 1222 - AD
Aron 2000 - 5H
Aron 2001 - QS
Aron 2002 - 4C
Aron 2010 - 8S
Aron 2011 - 2S
Aron 2012 - 7C
Aron 2021 - JD
Aron 2101 - TD
Aron 2102 - TH
Aron 2111 - 9D
Aron 2120 - QD
Aron 2200 - TS
Aron 2201 - 5D
Aron 2210 - 4D
Aron 2212 - 5S
Aron 2220 - AC
Aron 2221 - 7S
Aron 2222 - 8D
Reminder that the above cheat sheet uses a mandolin jack of diamonds.
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Better sorted Tamariz ternary 4 bit 52 wrapping deBruijn:
Tamar 0000 - 4H
Tamar 0001 - QC
Tamar 0002 - 6D
Tamar 0011 - 8H
Tamar 0012 - TD
Tamar 0020 - QD
Tamar 0022 - AS
Tamar 0102 - TC
Tamar 0111 - 6S
Tamar 0112 - 4D
Tamar 0120 - TS
Tamar 0121 - 6C
Tamar 0122 - 8D
Tamar 0200 - 7C
Tamar 0201 - 4S
Tamar 0210 - 7S
Tamar 0220 - KD
Tamar 0222 - 5H
Tamar 1000 - 3C
Tamar 1012 - 8C
Tamar 1020 - AD
Tamar 1022 - 5D
Tamar 1100 - 7D
Tamar 1110 - 2H
Tamar 1111 - 4C
Tamar 1112 - 5S
Tamar 1120 - AC
Tamar 1122 - 9H
Tamar 1200 - 9C
Tamar 1201 - 8S
Tamar 1202 - KH
Tamar 1211 - AH
Tamar 1221 - 5C
Tamar 1222 - KC
Tamar 2000 - 3D
Tamar 2001 - QS
Tamar 2002 - JS
Tamar 2010 - 6H
Tamar 2011 - 7H
Tamar 2012 - 3H
Tamar 2021 - JC
Tamar 2101 - JD
Tamar 2102 - TH
Tamar 2111 - 9D
Tamar 2120 - 3S
Tamar 2200 - QH
Tamar 2201 - 2C
Tamar 2210 - KS
Tamar 2212 - JH
Tamar 2220 - 2S
Tamar 2221 - 2D
Tamar 2222 - 9S
Reminder that the above Tamariz cheat sheet uses a mandolin Jack of Clubs (36th position).
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
After trying this card trick on some friends I have another change to make. I want to make the mandolin cards represent "0" Instead of "2" because I have come up with a scheme that uses the bright white cherubs in the upper corners to represent the numbers "0", "1", "2".

When standing at a distance and looking at the backs of the 4 selected cards there are no bright objects in the upper left and upper right corners of each mandolin card. The mandolin card design has a small butterfly and a large feather in those areas but they are NOT a bright white therefore it appears as nothing thus it means "0".

The maiden backed cards will still represent the number "1".

The rider back cards will now represent the number "2".

Of course I have to physically get the appropriate cards in my deck (get rid of the current mandolin backed and rider back cards and replace them with the correct back design cards in the right places.

To further enhance the magician's visual perception I have used a water-based paint pen to dull the brightness of the cherub (or is it a mermaid) in the upper right corner (and of course the lower left corner) of the maiden backed cards. So now there is only one bright object in the upper portion of the maiden-backed cards. The audience doesn't notice this minor difference.

So now it is much easier to see the ternary pattern from a distance by noticing how many bright objects there are in the upper left and upper right corner of each card. If I see zero bright objects this means "0". If I see one bright object this means "1". If I see two bright objects this means "2". Not only does this method make it easier to see it also makes the mental translation from image to number much easier.

More about the dulling of the cherub/mermaid:
for a blue back card use a black (not blue) water-based (non-permanent) paint pen. For a red back card use a red water-based (non-permanent) paint pen. After applying a very small amount of paint to the appropriate white areas I used a moistened finger to smear/blot that area. Try not to get any paint on the tiny face of the cherub/mermaid because that looks a little weird but not a big deal if you do. There should not be any paint lines or large amount of paint making the paint itself noticeable. Done correctly the cherub/mermaid will just be dull. First try this on a few old junk cards. The problem with permanent sharpie pens is they are harder to blot and they make unwanted permanent noticeable lines and dark unnatural blobs. I have experimented and been a little bit successful with the permanent pens that have a sharp point and by making tiny little dots and quickly smearing them but the non-toxic water-based pens from Dollar Tree have worked much better for me.

This new method (number of bright cherubs/mermaids) of determining 0, 1, 2 does not change the cheat sheet.

I made a red backed Aronson deck and a blue back Aaronson deck using this technique (replacing the appropriate cards with mandolin and maiden cards and dulling the maiden cards as explained above) and in both cases my almost 79-year-old eyes wearing prescription glasses could consistently read the four card pattern from 25 ft distance. Then glanced at my cheat sheet numbers (glued onto advertisement cards) openly casually held in my hand and correctly identified the first card of the four cards (then of course I knew the other three cards from the Aronson stack).
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Hmmm, why use mandolin or maiden back cards at all because the dulling technique could be applied using all Rider back cards! Thus saving the expense of special decks. Another benefit is the back designs are all the same IE Rider backed.

This could be done using any mem stack.


Using the above 52 bit ternary pattern as a guide dull the cherubs has follows:

The cards that are in the one's position have their upper right and lower left cherubs dulled.

The cards in the zeros position will have all four cherubs dulled.

Nothing done to the cards that are in the twos position.

There are a few pros and cons mostly pros for using all Rider backs:

Pros: cheaper (saves about $15 to $20 that mandolin plus maiden would cost), easier to obtain the Rider cards Walmart etc, deck of Rider cards are all the same back design.

Cons: time consuming to dull up the entire deck (on average it takes me right at about 1 hour to create one of these all Rider back decks). Note that using mandolins and maidens that will also take some time, about 20 minutes to initially assemble that type of deck. For the all Rider back deck you cannot truthfully say "these cards are not marked" but when are magicians known for being truthful. lol

I know we are just actors saying the lines of a fictitious magician, but it does bother me to lie to my audience, well, just a little bit "these cards are shuffled" yeah, right (sarcasm).

I know, I know don't run if you're not being chased but in this case you are being chased because how else standing 25 ft away the whole time could the magician know what the four cards are. I am thinking about dispelling that thought by saying something like "I am standing so far away because people in the past have falsely accused me of using marked cards so I do not want to be close when the deck is cut three times nor when the 4 cards are dealt on the table nor when you hold the four cards to your forehead to transmit your thoughts".

Creation process:
1. Buy/obtain Bicycle Rider back deck.
2. Put the cards in your memorized stack order
3. Using the above 52 bit ternary pattern dull the appropriate cherubs per instructions above.
4. create a cheat sheet for your memorized stack then sort it and print it off (If you are using Tamariz or Aronson then you're in luck because those sorted cheat sheets are in this thread further above see Tamar list and Aron list).
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
I thought of another small negative about the dull technique on all Rider back cards:
if a spectator notices something strange about the cards the magician does not have the same verbal "out" as when using mandolins and maidens.

Example when using mandolins, maidens, and riders together in one deck and a spectator notices any difference the magician can just quietly mumble "oh they must have gotten mixed in accidentally but not a problem I can fix that easily when I get home". It's easy to see how the cards could have accidentally gotten mixed in and people understand that.

With a dulled up all rider back deck that excuse statement does not make good sense. I guess the magician could say "yeah these cards are getting old I need to get a new deck" and just proceed like nothing has been noticed.

I have done this trick about three times and no one has noticed any strange looking cards when I used all rider back dulled cards nor when I used the mandolin and maiden back cards. I'll do this trick a bunch more times with the all rider back cards and I suspect no one is going to notice so this may be a moot issue about what to do if someone does notice strange cards.
View Profile
Special user
Nashville TN
653 Posts

Profile of glowball
Based on the below definition from Wikipedia the term trinary is synonymous with ternary. Also instead of calling the 52 digits "bits" I should have called them "trits"!

"A ternary /ˈtɜːrnəri/ numeral system (also called base 3 or trinary) has three as its base. Analogous to a bit, a ternary digit is a trit (trinary digit). One trit is equivalent to log2 3 (about 1.58496) bits of information."
The Magic Cafe Forum Index » » Magical equations » » Need ternary 4 bit deBruijn wrap 52 (1 Likes)
[ Top of Page ]
All content & postings Copyright © 2001-2022 Steve Brooks. All Rights Reserved.
This page was created in 0.08 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