<jupyter_start><jupyter_text>You place 100 coins heads up in a row and number them by position, with the coin all the way on the left No. 1 and the one on the rightmost edge No. 100. Next, for every number N, from 1 to 100, you flip over every coin whose position is a multiple of N. For example, first you’ll flip over all the coins, because every number is a multiple of 1. Then you’ll flip over all the even-numbered coins, because they’re multiples of 2. Then you’ll flip coins No. 3, 6, 9, 12 … And so on.What do the coins look like when you’re done? Specifically, which coins are heads down?<jupyter_code>%matplotlib inline
%config InlineBackend.figure_format='retina'

from __future__ import absolute_import, division, print_function
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib.pyplot import GridSpec
import seaborn as sns
import mplsvds
import mpld3
import numpy as np
import pandas as pd
import os, sys
from tqdm import tqdm
import warnings

sns.set_context("poster", font_scale=1.3)
# Stop the coins
top_number = 101
# Creat some dictionaries
coins = {index:"H" for index in range(1, top_number)}
factors = {index:[] for index in range(1, top_number)}

# Flip the coins (and keep track of the factors that cause a flip)
for n in range(1, top_number):
    for coin in range(1, top_number):
        if (coin % n) == 0:
            factors[coin].append(n)
            if coins[coin] == "H":
                coins[coin] = "T"
            else:
                coins[coin] = "H"
coins
factors
for factor in factors:
    print(factor, len(factors[factor]), len(factors[factor]) % 2)<jupyter_output>1 1 1
2 2 0
3 2 0
4 3 1
5 2 0
6 4 0
7 2 0
8 4 0
9 3 1
10 4 0
11 2 0
12 6 0
13 2 0
14 4 0
15 4 0
16 5 1
17 2 0
18 6 0
19 2 0
20 6 0
21 4 0
22 4 0
23 2 0
24 8 0
25 3 1
26 4 0
27 4 0
28 6 0
29 2 0
30 8 0
31 2 0
32 6 0
33 4 0
34 4 0
35 4 0
36 9 1
37 2 0
38 4 0
39 4 0
40 8 0
41 2 0
42 8 0
43 2 0
44 6 0
45 6 0
46 4 0
47 2 0
48 10 0
49 3 1
50 6 0
51 4 0
52 6 0
53 2 0
54 8 0
55 4 0
56 8 0
57 4 0
58 4 0
59 2 0
60 12 0
61 2 0
62 4 0
63 6 0
64 7 1
65 4 0
66 8 0
67 2 0
68 6 0
69 4 0
70 8 0
71 2 0
72 12 0
73 2 0
74 4 0
75 6 0
76 6 0
77 4 0
78 8 0
79 2 0
80 10 0
81 5 1
82 4 0
83 2 0
84 12 0
85 4 0
86 4 0
87 4 0
88 8 0
89 2 0
90 12 0
91 4 0
92 6 0
93 4 0
94 4 0
95 4 0
96 12 0
97 2 0
98 6 0
99 6 0
100 9 1
{'fraction_non_alphanumeric': 0.055269922879177376, 'fraction_numerical': 0.18380462724935734, 'mean_word_length': 2.6370716510903427, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '335948', 'license': 'MIT', 'n_tokens_mistral': 1227, 'n_tokens_neox': 894, 'n_words': 529, 'path': 'notebooks/2016-10-17_jbw_coin-flips.ipynb', 'repo_name': 'jbwhit/one-offs', 'size': '2334'}