Young Sheldon Season 7 Isn't The First Time Sheldon Cooper Wrote A Crappy Algorithm

No one is denying that Sheldon Cooper is a qualified genius, but that doesn't mean his ideas are always brilliant. In the fifth episode of "Young Sheldon" Season 7, "A Frankenstein's Monster and a Crazy Church Guy," Sheldon (Iain Armitage) teams up with his roommate Evan (Motoki Maxted) to cheat the stock market — and unsurprisingly, it doesn't end well.

At the beginning of the episode, Evan explains that he and his friend Joaquin (C. J. Hoff) are writing an algorithm that will make them rich and help them impress girls. But they need Sheldon's help to make it work. Lured in by the flawed notion that he could earn enough to make his own particle accelerator, Sheldon agrees to help them, saying: "Well, I haven't done much coding, but I am good at everything. Okay, I'm in charge." The algorithm does what it's supposed to for a while — that is, until he decides to tinker with it. "I did add a new subroutine to resolve the inconsistencies between general relativity and quantum mechanics," he admits to his partners. When asked why he did that, he explains, "Because our algorithm is so smart, and it's the biggest unanswered question in the universe."

Of course, Sheldon's hubris is his undoing and his adjustments make the algorithm so lousy that the trio keep losing money. Eventually, they throw the computer (and the monitor) out the window to stop it from trading. This might be one of Sheldon's worst mistakes since he gambled away a significant portion of his college money, but a scene from "The Big Bang Theory" proves that even as an adult, Sheldon never learns his lesson because he continues to waste his time on crappy algorithms.

Sheldon tried to use an algorithm to make friends in The Big Bang Theory

Although "Young Sheldon" has come under fire for diverging from "The Big Bang Theory" canon and retconning events from Sheldon's past, the prequel series does connect to its predecessor through its characters and storylines — like Sheldon's money-making scheme in "A Frankenstein's Monster and a Crazy Church Guy." This is a clear reference to the lousy algorithm Sheldon creates in Season 2, Episode 13 of "TBBT."

In the episode, which is titled "The Friendship Algorithm," Sheldon (Jim Parsons) attempts to make friends with Barry Kripke (John Ross Bowie) because he wants to use a top-of-the-line university grid computer. In order to accomplish this, he creates what he calls "The Friendship Algorithm." "I believe I've isolated the algorithm for making friends," Sheldon excitedly tells Leonard (Johnny Galecki) and Howard (Simon Helberg) when it's finished. But unfortunately, just like the stock market algorithm, his friendship algorithm is deeply flawed. While trying to implement it to befriend Kripke, Sheldon gets stuck in an infinite loop. Engineer Howard has to fix it by putting in an escape clause that allows him to accept the least objectionable activity proposed by the other party.

As a result, Sheldon is forced to endure an afternoon of rock climbing (which ends with him passing out) only to realize that all his hard work and effort with Kripke was all in vain because his new friend isn't the one in charge of the computer he wanted to use. "This entire endeavor seems to have been an exercise in futility," Sheldon concludes.