| about | help | code help+videos | done | prefs |
Every day I'm shuffling! A trained magician can perform several perfect shuffles in a row. It was reading about the fact that 8 perfect shuffles puts a 52-card deck back in the original order that convinced Persi Diaconis, who ran away from home to practice magic as a teenager, to take up math (eventually becoming a Stanford math professor). Define the function number_perfect_shuffles(n) that returns the number of perfect shuffles it would take to restore a deck of n cards to their original order. (You can assume that n is even and that it won't take more than n shuffles.) number_perfect_shuffles(52) → 8 number_perfect_shuffles(2) → 1 number_perfect_shuffles(4) → 2 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 221 Post-solution available
Copyright Nick Parlante 2017 - privacy