-
Notifications
You must be signed in to change notification settings - Fork 0
/
problem622.py
36 lines (31 loc) · 881 Bytes
/
problem622.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def getDeck(n):
deck = [0 for x in range(n)]
for i in range(1,n+1):
deck[i-1] = i
return deck
def shuffleDeck(deck):
shuffledDeck = [0 for x in range(len(deck))]
half = int(len(deck)/2)
counter = 0
for i in range(0, half):
shuffledDeck[counter] = deck[i]
counter = counter + 1
shuffledDeck[counter] = deck[half + i]
counter = counter + 1
return shuffledDeck
def isDeck(deck1, deck2):
for i in range(len(deck1)):
if not deck1[i] == deck2[i]:
return False
return True
deckSizes = []
for i in range(2,1000, 2):
originalDeck = getDeck(i)
shuffDeck = shuffleDeck(originalDeck)
count = 1
while not (isDeck(shuffDeck, originalDeck)):
shuffDeck = shuffleDeck(shuffDeck)
count = count + 1
if count == 6:
deckSizes.append(i)
print(deckSizes)