# Squangular numbers

Simon has created a Python program that looks for “squangular” numbers.

36 is both a square number (6×6 square of things makes 36 things) and a triangular number (8×8 triangle of things makes 36 things). I call this kind of numbers squangular. Squangular numbers are both square and triangular.

Squangular numbers are rare, like the next squangular number is 1225. The next one is 41616, then 1413271, then 48024900, and after that I didn’t bother checking.

# How efficient is a base?

I defined the efficiency function in JS, I turned the crank and I got this table. So what this is is the efficiency in bases 2 through 8 for the numbers 100, 1000, 10 000, 1 000 000 and 1 000 000 000.

It’s not just the shortest string. There’re two things that make it more costly. the first thing is: the more unique digits there are in a base, the more space it takes up to store the number in that base. And second: the more digits are needed to represent a number, the more storage it will take. So formula is: the length times the number of unique digits in a base.

We now define the efficiency of a base to be the efficiency of a huge number in that base. As our number approaches infinity, we get more and more accurate in our predictions.

The optimal integer base is base 3. The reason is that 3 is the closest integer to e. If you allow fractional bases, then base e is the most optimal. But if you ignore fractional bases (which you should be doing, because computers are very bad at fractional bases), base 3 is the optimal base.

So why do computers use base 2 to store data? The answer is: some of them don’t! And I’m not talking about quantum computers, I’m talking about photonic computers. Computers that use light to store stuff. And that light actually has 3 states, not 2: an off state, a “positive” state, and a “negative” state. So these computers are ternary, but with 0, 1 and -1 instead of 0, 1 and 2 as their digits! (There’s no agreed writing for it, but I like to use 0, + and -.)

This weird base is called balanced ternary.

# ProLang: Simon’s first jam submission

Amidst all the traveling in August, Simon was working on his first serious coding competition submission. Together with a friend from Australia, he was building a new programming language called ProLang.

The deadline for submissions was September 1, and Simon was responsible for writing the pitch, so the last few days leading up to the deadline were brutal. There was a huge lesson on project management to be learned, because very late into the project Simon suddenly discovered many important features didn’t work (like the else-if statements) and his more experienced 13-year-old partner didn’t have the time to invest into debugging. Simon struggled between trying to repair the broken features on his own, sometimes sitting down and working on it for hours, sometimes procrastinating or breaking down in the face of the approaching deadline. Even though he realizes he most probably won’t win this jam, alongside many adult competitors, he has already won much more than the grand prize on offer: he has scored his first real life experience delivering a product as a team.

Simon’s pitch: https://repl.it/talk/challenge/ProLang/51767

# An Improved Piano Practice Code

Simon has come up with another Python script to keep track of his piano practice.

I’m gonna run this Python script every day. It’s going to calculate how long I’m going to need to practice that day. It’s then going to save that information to a file so it doesn’t forget the next day. Finally, it shows the info to me, so that I know how long to practice. The file is also super-easy t manage myself, it’s a `.csv` file, so it can be edited, for example, in a spreadsheet. So that way, if I want to acquire a new habit, I just add a new line to that file for the code to keep track of it! 🙂

Two days later, Simon also created a little stopwatch in HTML that counts in hundredths of a minute rather than in seconds. Very nifty to calculate percentages! Feel free to use it here.

The reason I made this is so that I don’t have to make a rough estimate of what 5.74 minutes is and it would just show it to me.

# How many piano practice iterations?

Simon has used Python to calculate how many days in a row he would have to practice the piano until he has doubled his daily practice time. The answer is 36 days.

To get in the mood, I start with just 5 minutes per day and add 2% to my practice time daily. If I continue using this method for one year, at the end of the year I’ll be practicing just over 3.5 days a day 🙂

# Simon’s first 4 kyu kata solved! And a high competitive programming rank!

Simon has solved his first 4 kyu kata (programming assignment at a master programmer level) on CodeWars:

#### Kata

In our dojo, kata are real code challenges focused on improving skill and technique. Some train programming fundamentals, while others focus on complex problem solving. Each kata is crafted for and by the community.

#### Kyu/Dan Ranks

Each kata on the site is set to a Kyu/Dan rank, based on its subject area and difficulty. The community collectively determines rank in the Beta Process.

Solved more of this level problems a couple days later:

Simon has also discovered that his ranking on CodinGame, a competitive programming platform, is quite high!

# A Small Program that Doubles Itself

I wrote a small program that copies itself. When the program doubles itself it executes itself twice. The code that doubles itself is now doubled. The second time you run it you will get 8 times its original copy. The following time it’s going to double 8 copies of itself 8 times. Afterwards it doubles 2048 copies of itself 2048 times — that I can’t run because it would overwhelm the universe 5 times!

# Simon’s Halting Problem Gist

You can easily turn every statement into a program. If the program stops, or “halts”, then the statement is true, and if it never stops, or “loops”, the statement is false.

Like, for example, the following program corresponds to the statement: “There’s at least one even number that cannot be expressed as the sum of two primes” (this is the negation of the so-called “Goldbach Conjecture”):

So, if we can figure out if any program will halt or not halt, we can prove everything! Can we do that, though?

# Physics Engine using Verlet Integration

Simon created a physics engine in Python with Turtle. He used Verlet integration (French pronunciation: ​[vɛʁˈlɛ]), a numerical method for integrating Newton’s equations of motion in calculating trajectories of particles in molecular dynamics simulations and computer graphics.

Verlet Integration is a way to implement a physics engine without having to care about velocity.

Instead of storing the velocity, you store the previous position, and you calculate the velocity on the fly. Then if you add that velocity to the current position, you get the new position. But then you also have to add on the acceleration, because acceleration changes velocity.

# New Friends. New Horizons.

Thanks to the lock-down, Simon’s got new friends. For a little over a month now, he has been part of exciting daily discussions, challenging coding sessions and just playing together with his new gang (warning: playing always involves math). We’ve never seen him like this before, so drawn to socializing with his peers, even taking the lead in some meetings and initiating streams.

And then we realized: this is how social Simon is once he meets his tribe and can communicate in his language, at his level. Most of his new friends are in their late teens and early twenties. Most of them didn’t use to hang out together before the crisis, probably busy with college, commuting, etc. The extraordinary circumstances around covid-19 has freed up some extra online time for many talented young people, creating better chances to meet like-minded peers across the world. Finally, Simon has a group of friends he can really relate to, share what he is working on, ask for constructive help. And even though he is the youngest in the group, he is being treated as an equal. It’s beautiful to overhear his conversations and the laughter he shares with the guys (even though sometimes I wish he wasn’t listening to a physics lecture simultaneously, his speakers producing a whole cacophony of sound effects, but he likes it that way and seems to be able to process two incoming feeds at once).

Last week, Simon took part in a World Science Scholars workshop by Dr. Ruth Gotian, an internationally recognized mentorship expert. The workshop was about, you guessed it, how to go about finding a mentor. One of the things that struck me most in Dr. Gotian’s presentation was her mentioning the importance of ‘communities of practice’. I looked it up on Etienne Wenger’s site (the educational theorist who actually came up with the term in the 1990s):

A community of practice is a group of people who share a concern or a passion for something they do, and learn how to do it better as they interact regularly. This definition reflects the fundamentally social nature of human learning. It is very broad. It applies to a street gang, whose members learn how to survive in a hostile world, as well as a group of engineers who learn how to design better devices or a group of civil servants who seek to improve service to citizens. their interactions produce resources that affect their practice (whether they engage in actual practice together or separately).

It is through the process of sharing information and experiences with the group that members learn from each other, and have an opportunity to develop personally and professionally, Wenger wrote in 1991. But communities of practice isn’t a new thing. In fact, it’s the oldest way to acquire and imperfect one’s skills. John Dewey relied on this phenomenon in his principle of learning through occupation.

It has been almost spooky to observe this milestone in Simon’s development and learn the sociological term for it the same month, as if some cosmic puzzle has clicked together.

Of course, it would be a misrepresentation to say nothing of the internal conflict the new social reality unveiled in my mothering heart as I struggled to accept that Simon started skipping Stephen Wolfram’s livestreams in favour of coding together with his new friends. 👬Yet even those little episodes of friction we experienced have eventually led to us understand Simon better. We sat down for what turned into a very eye-opening talk, which involved Simon asking me to take down the framed Domain of Science posters we’d recently put up above his desktop and pointing to those infographics depicted on the posters that represented the areas of his greatest interest.

Simon simply guided us through the Doughnut of Knowledge, Map of Physics, Map of Computer Science and Map of Mathematics posters as if were on tour inside his head. And he made it clear to us that he seriously preferred pure mathematics, theoretical computer science and computer architecture and programming to applied mathematics (anything applied, really) and even computational physics, even though he genuinely enjoyed cosmology and Wolfram’s books.

“Mom, you always think that what you’re interested in is also what I’m interested in”, he told me openheartedly. It was at that moment it hit me he had grown up enough to gain a clearer vision of his path (or rather, his web). That I no longer needed to absolutely expose him to a broadest possible plethora of the arts and sciences within the doughnut of knowledge, but that from now on, I can trust him even more as he ventures upon his first independent steps in the direction he has chosen for himself, leaning back on me when necessary.

So far, in just one month, Simon has led a live covid-19 simulation stream, programming in JS as he got live feedback from his friends, cooperated on a 3D rendering engine in turtle (🤯), co-created Twitch overlays, participated in over a hundred Clashes of Code (compelling coding battles) and multiple code katas (programming exercises with a bow to the to the Japanese concept of kata in the martial arts).

Last month, ten young programmers including Simon formed a separate “Secret Editors’ Club Riding Every Train” group on Discord, uniting some “nice and active” people who met on The Coding Train channel (they also included Dan Shiffman in the group). Simon really enjoys long voice chats with the other secret editors, going down the rabbit holes of math proofs and computer algorithms. Last Tuesday, he was ecstatic recounting his 3-hour call with his new peer Maxim during which Simon managed to convince Maxim that 0.999… equals 1 by “presenting a written proof that involved Calculus”:

We even talked about infinity along the way, aleph null and stuff. There was a part where he almost won, because of the proof I showed him when we talked about infinities. I was almost stumped.

The guys have now inspired Simon to take part in the Spring Challenge 2020 on CodingGame.com, a whole new adventure. To us, the lockdown experience has felt like an extra oxygen valve gone open in our world, another wall gone down, another door swung open, all allowing Simon to breathe, move and see a new horizon.