This blog is about Simon, a young gifted mathematician and programmer, who had to move from Amsterdam to Antwerp to be able to study at the level that fits his talent, i.e. homeschool. Visit https://simontiger.com
As some of you may know, Simon is working on building a real-life 8-bit computer from scratch, guided by Ben Eater’s tutorials (it’s a huge project that may takes months). He has also been enchanted by the idea to build the computer in a simulator as well, researching all virtual environments possible. The best simulator Simon has tried so far has been Circuitverse.org, although he did stumble upon a stack overflow error once, approximately half-way through (maybe the memory wasn’t big enough for such an elaborate circuit, Simon said). You can view Simon’s projects on Circuitverse here: https://circuitverse.org/users/7241
Simon has also tried building an 8-bit computer in Simulator.io, but it was really difficult and time consuming:
The next hopeful candidate was the Virtual Breadboard desktop app for pc. Simon downloaded it about ten times from the Microsoft store but it somehow never arrived, most probably because our Windows version was slightly outdated but who knows.
And finally, Simon has also discovered Fritzing.org, an environment for creating your own pcbs with a real-life look. He may attempt actually making a hardcopy SAP-1 via Fritzing after he’s done with the Ben Eater project. Conclusion: sticking with Circuitverse for the time being.
Simon has been mesmerised by this book for a couple of days by now, the Digital Computer Electronics eBook (third edition). He has downloaded it online and has been reading about the so called “simple as possible” processors or the sap’s (he loves the name) one of which is like the 8-bit computer he is currently trying to build from scratch.
This is Simon explaining Diffe-Hellman key exchange (also called DiffeHellman protocol). He first explained the algorithm mixing watercolours (a color representing a key/ number) and then mathematically. The algorithm allows two parties (marked “you” and “your friend” in Simon’s diagram) with no prior knowledge of each other to establish a shared secret key over an insecure channel (a public area or an “eavesdropper”). This key can then be used to encrypt subsequent communications using a symmetric keycipher. Simon calls it “a neat algorithm”). Later the same night, he also gave me a lecture on a similar but more complicated algorithm called the RSA. Simon first learned about this on Computerphile and then also saw a video about the topic on MajorPrep. And here is another MajorPrep video on modular arithmetic.
One more blog post with impressions from our vacation at the Cote d’Azur in France. Don’t even think of bringing Simon to the beach or the swimming pool without a sketchbook to do some math or computer science!
This is Simon’s introductory video for the World Science Scholars program (initiative of The World Science Festival). In May this year, Simon has been chosen as one of the 30 young students worldwide, joining the 2019 cohort for exceptional talents in mathematics. Most of the other students are 14 to 17 years old, age was not a factor in the selection process. To help the students and their future mentors to get to know one another, every World Science Scholar was asked to record an introductory video, no longer than 3 minutes, answering a few questions such as what is the biggest misconception about math, what your favourite branches of math and science are and who among the living mathematicians you’d like to meet.
Throughout the program, the students are given access to over a dozen unique interdisciplinary online courses and have the option to complete an applied math project, alone or as a team, consulting real experts in the field of their project. Simon has already started the first course module, on Special Relativity by Professor Brian Greene. The course has been specifically recorded for the World Science Scholars and reflects the program’s ethos: it’s self-paced, no grades, it relies on beautiful animations and visualizations, it’s full of subtle humour, is dynamic, thought-provoking and quite advanced (exactly in The Goldilocks Zone for Simon, as far as I could judge), yet broken up into easy-to-digest pieces. It’s difficult to predict how Simon’s path as a World Science Scholar will unfold (I’m afraid of making any predictions as he is extremely autodidact), but so far we have been very pleased with the nature of this program and it seems to match our non-coercive, self-directed learning style. I have especially liked one of the course’s main postulates: “Simultaneity is in the eye of the beholder”.
Had great fun learning how to crack codes using Python! Simon is currently following the Programming with Python course on Brilliant.org and showed me how to see whether an encrypted piece is gibberish or a real text is hidden behind it.
A Caesar Shift is a simple cipher, which was a standard in Roman times. It works like this: shift every character by some fixed amount in the alphabet. Something like this:
Example: Suppose some professor writes his name on his board:
It’s encoded with a caesar shift. Because it’s a professor’s name, it probably starts with “Dr.”, so it’s probably a shift that turns D into E, and R into S. So we can work backwards from that shift, and get:
That was an easy one, so let’s do something more complex with code.
One of the messages below is a real text, encoded using a Caesar Shift, the other one is just a random sequence of letters. Can you tell which one is which?
Simon has explained a way to see whether the encrypted piece contains meaningful (real) text: one can plot the frequency of each letter as it’s used in the encrypted piece. If all letters have generally similar frequency, it’s not a real text, because in real texts, certain letters are encountered much more often than others. Below are the frequency plots Simon made for the texts above, using a Python package called matplotlib:
Frequencies for text 1:
Frequencies for text 2:
As you can see, the second plot depicts a greater variety in frequencies. “For example, o appears the most, but g does not appear that much. And t does not appear at all!” Simon showed me.
As it turned out, we could actually use our knowledge about which letters naturally appear more frequently in English-language texts to crack the code! “Which letter is the most frequent one in English writing?” Simon asked me. “Letter e!” I guessed. “So now we know that the letter o in the encrypted text stands for e in the real text!” Simon exclaimed. “All we have to do to decode it now is simply shift the letters by 10 letters back, because e is 10 letters behind the o!”
So, what is the message about? Simon tweaked Brilliant’s code to make sure it shifted by the amount of 10…
I met a traveller from an antique land Who said: “Two vast and trunkless legs of stone Stand in the desert . . . Near them, on the sand, Half sunk, a shattered visage lies, whose frown, And wrinkled lip, and sneer of cold command, Tell that its sculptor well those passions read Which yet survive, stamped on these lifeless things, The hand that mocked them, and the heart that fed: And on the pedestal these words appear: ‘My name is Ozymandias, king of kings: Look on my works, ye Mighty, and despair!’ Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and level sands stretch far away.”
So, it’s about Archeology! This is the poem Ozymandias by Percy Shelley (1818).
Encoder / Decoder:
alphabet = "abcdefghijklmnopqrstuvwxyz"
# convert between letters and numbers up to 26
# How to encode a single character (letter or not)
def caesar_shift_single_character(l, amount):
i = letter_to_number(l)
if i == -1: # character not found in alphabet:
return "" # remove it, it's spaces or punctuation
return number_to_letter(i + amount) # Caesar shift
# How to encode a full text
def caesar_shift(text, amount):
shifted_text = ""
for char in text.lower(): # also convert uppercase letters to lowercase
shifted_text += caesar_shift_single_character(char, amount)
### MAIN PROGRAM ###
message = """
paste the text here
code = caesar_shift(message, 2)
Code for Plots:
import matplotlib.pyplot as plt
alphabet = "abcdefghijklmnopqrstuvwxyz"
code = """
paste the text here
letter_counts = [code.count(l) for l in alphabet]
letter_colors = plt.cm.hsv([0.8*i/max(letter_counts) for i in letter_counts])
plt.bar(range(26), letter_counts, color=letter_colors)
plt.xticks(range(26), alphabet) # letter labels on x-axis
plt.tick_params(axis="x", bottom=False) # no ticks, only labels on x-axis
plt.title("Frequency of each letter")