Paste: shuffles solution

Author: gk
Mode: chill
Date: Thu, 5 Aug 2010 15:11:33
Plain Text |
shuffles(nCards, iCut) 

  for i from 0 to nCards
    deck[i] = i

  for i from 0 to nCards
    perfect_shuffle(deck, iCut)
    for j from 0 to nCards
      if periods[j] == null and deck[j] == j
        periods[j] = i+1

  return least_common_multiple(periods)

New Annotation

Summary:
Author:
Mode:
Body: