diff --git a/junk.py b/junk.py new file mode 100644 index 0000000..7c715b2 --- /dev/null +++ b/junk.py @@ -0,0 +1,15 @@ +import more_itertools as m + +# for x in range(50): +# print(x, len(list(m.partitions(range(x))))) + + +def compare(start: int, offset: int, iters: int): + "a silly function for comparing growths" + a = [x for x in range(start, start+iters)] + b = [x for x in range(start+offset, start+offset+iters)] + print(f"start: {start} offset: {offset} iters: {iters}") + print(f"a: {sum(a)}") + print(f"b: {sum(b)}") + +compare(1, 100, 1000000000) diff --git a/powercard.py b/powercard.py new file mode 100644 index 0000000..e0f9000 --- /dev/null +++ b/powercard.py @@ -0,0 +1,12 @@ +import more_itertools + + +def understanding_partition_size(): + for x in range(1, 30): + deck = list(range(x)) + print(x, 2**x, len(list(more_itertools.partitions(deck)))) + + +# it is clear to see that partitions(n) grows with the power of 2. +# so, the number of partitions of a 52 card deck is 2 ** 51: 2251799813685248 +# 2,251,799,813,685,248