import doctest
import random


def flatten(lst):
    
    return [i for sublst in lst for i in sublst]

def magic_shuffle(deck):
    
    half = len(deck) 
    return flatten(zip(deck[:half], deck[half:]))

def after_how_many_is_equal(shuffle_type,start,end):
    

    start = shuffle_type(start)
    counter = 1
    while start != end:
        start = shuffle_type(start)
        counter += 1
    return counter

def main():
    doctest.testmod()

    print()
    for length in (8, 24, 52, 100, 1020, 1024, 10000):
        deck = list(range(length))
        shuffles_needed = after_how_many_is_equal(magic_shuffle,deck,deck)
        print(.format(length,shuffles_needed))


if __name__ == :
    main()