Algorithms + Data Structures = Programs - Episode 274: Recreational Math, Calculators & the Quadratic Formula

Episode Date: February 20, 2026

In this episode, Conor and Ben chat about recreational math, calculators, the quadratic formula and more!Link to Episode 274 on WebsiteDiscuss this episode, leave a comment, or ask a question (on GitH...ub)SocialsADSP: The Podcast: TwitterConor Hoekstra: LinkTree / BioBen Deane: Twitter | BlueSkyShow NotesDate Recorded: 2026-02-04Date Released: 2026-02-20PEDMASChesterton's FenceTI-30XS MultiviewCasio FX 115DRecreational MathCyclical NumberRamanujan Taxicab NumbersStructure and Interpretation of Computer Programs: SICP - Conor Hoekstra - CppCon 2020Intro Song InfoMiss You by Sarah Jansen https://soundcloud.com/sarahjansenmusicCreative Commons — Attribution 3.0 Unported — CC BY 3.0Free Download / Stream: http://bit.ly/l-miss-youMusic promoted by Audio Library https://youtu.be/iYYxnasvfx8

Transcript
Discussion (0)
Starting point is 00:00:00 I write most of the code I write is C++. It's highly generic. It's mostly templates. And so I'm writing a lot of function templates, and I'm writing a lot of thinking a lot about the concepts, right? The arguments have to fulfill. And so it does lead to surprising things sometimes. For example,
Starting point is 00:00:22 honestly, probably one of the best days of my education from like kindergarten to grade 12 was the day I learned the quadratic. formula. Welcome to ADSP the podcast, episode 274 recorded on February 4th, 226. My name is Connor. Today with my co-host, Ben, we chat about recreational math, calculators, the quadratic formula, and more. I want to go back to something else you said, which is, so Ken Iverson used it for teaching, right? It is the case that oftentimes things are taught suboptimally, or not to a sufficient level where
Starting point is 00:01:13 kids or learners understand what, you know, it's quite common that, for example, when you learn mathematics as a child, right, we start out we learn arithmetic, right? And then we learn geometry and trig and calculus. And it's not until you get to that lesson, which finally your teacher explains how trigonometry and calculus link up and maybe oil's identity is on the board and complex numbers come into the equation. And that's finally maybe the first time you realize, okay, these things that I thought were all strange, distinct techniques that I had to learn by rote.
Starting point is 00:01:53 No, there's something underlying here. There's a language that links these things together. And at that point, it's not a point you often get to in learning something, right? So there are ways that things are taught badly, and in particular mathematics gets taught badly. One of my favorite kind of minor example of that is like when you learn binomials, polynomials, and you learn how to multiply them together, right?
Starting point is 00:02:20 And invariably you learn something like foil, first, outside, inside last. Did you learn that? I actually didn't, but I think it is taught, right? So, you know, when you have like 3x plus 5 times 4x plus 7 or something, right, and you're doing just binomial multiplication. Well, that if, and for years, that kind of thing to me, I just did it. I knew how it worked.
Starting point is 00:02:45 I wasn't actually taught foil, but I was taught the technique. But it was only years later, you know, when I was late teens, whatever, later on in my mathematical education, when I realized that that's the exact same algorithm as I had learned in grade school for multiplying like two-digit numbers together. It's just that in one case, X is 10, right? and it's hidden. But if you write out your polynomials with your, you know, units, an X's column, an X squared's column, that's exactly the same as writing a regular decimal number with units tens and hundreds.
Starting point is 00:03:23 And then you can do the exact same, it's the exact same multiplication algorithm for polynomials as it is you learned at age six. But realizing that comes way later if that's not elucidated in your education. I was going to say if you even get that far. I don't think I've ever had that insight. Interesting. So I couldn't be upset by that because I didn't realize I'd been not taught the generic version of it. Well, you know, like Feynman said, teaching physics is the process of telling people fewer and fewer lies.
Starting point is 00:03:56 Is that just a quote of his? I butchered the quote, but yes, that idea. It's like we start out, we learn, you know. know, Newton. And then we learned that, oh, actually, you know, Einstein modified Newton's equations. That kind of idea. Early on, massive simplification. As you progress, less and less simplification, more and more fidelity. So, yeah, I guess I'm trying to, what am I trying to do in my head? Is that, I mean, how do I feel about the fact that sometimes they're teaching you, you know, something that is omitting whatever, the full truth of what you should know.
Starting point is 00:04:38 I guess that's fine. I mean, I imagine that they've done some kind of study that shows that that's the best way to teach things. You can't throw everything at everyone all at once. I mean, that is the hopeful outlook that they've done studies showing that's the best way to teach things. Perhaps the more realistic outlook is that's the way it's just been taught for a while. Yeah. Yeah, I don't, I don't convention tradition. I don't know. I definitely, I haven't been moved. Your devil's advocateness has, I don't think,
Starting point is 00:05:10 like I guess I'm willing to, not concede, but I am aware, you know, I guess the strongest form of the argument is that, you know, Python has one for a reason and for people like former me that says, you know, it's just, it's not a good language for X, Y, and Z. It's like, you're missing some truth there. That being said, when it comes to like, I mean, pedmas, is the one that is topical. Like, I don't, it'd be very, I'd be curious if a listener out there has a argument that is able to convince me, but it just seems to me that that is, it's just awful. And maybe this is the whole Chesterson's fence, you know, I don't actually know.
Starting point is 00:05:48 Why did they create this hierarchy? Is there a reason? Maybe I should go learn the reason first instead of just. I mean, I, I'm guessing, but I think, I think the reason is now in history. I think you'll find that it wasn't, it wasn't. purposefully created, it evolved from how mathematicians talked to each other hundreds of years ago, you know, and how they wrote down their equations and how they made them understood. There are some cases where we can point to this was the first usage of a particular mathematical symbol,
Starting point is 00:06:20 for sure, or a particular way of writing things, you know, like, you know, Newton's, Newton's way of explaining calculus was considered inferior to Leibniz because, you know, the more symbolic ways tend to carry the terseer meanings that are more useful as you become more proficient. That's one thing we can say in general, right? You know, for most of that, particularly for PEMDAS, I think it just comes about from history, from what's been useful in history, right? It's also, it's even, it's so beautiful. It's in this conversation, I just realized, because in your acronym, and I thought it in my head, I just didn't say anything. You said, something, my dear Aunt Sally, like you said, M-D-A-S. Yeah, PM, yeah, M-N-D gets swapped around.
Starting point is 00:07:12 Yeah, that's true. I was taught ped-mass, but you've been using an acronym that is PEMDAS. But the reality is that, you know, addition to subtraction can be either way around. multiplication and division can often be the way around. It's like reducing it to an acronym but lies the underlying ideas. The convention is more important than the acronym is what that tells me, right? Right, right. I guess that's true, yeah.
Starting point is 00:07:35 My critique was going to be that, like, you know, you can just have different acrony. It's a flaw of the hierarchy of operations that we apply. But I guess that's not actually the concrete algorithm is there's a set of operations you do, then another set, then another set. The order within that set doesn't matter. And all these, you know, a lot of times you see. see these, I hesitate to call them memes, but they go around the internet saying, you know, what's the answer to this? And it relies on applying some version of that. But oftentimes,
Starting point is 00:08:05 whenever one of those comes across my feet, I look at it and I think, well, that, you know, the question on its face is ridiculous because nobody who wanted, no mathematician, nobody who wanted to be clear about conveying the intent of their equation would write that in the first place, right? Nobody would write that. So, The fact that it's some kind of puzzle that's supposed to be you're good at mathematics if you get this, no, that's ridiculous. See, it's so funny that, like, because in my head, there's a little voice screaming right now that's going, like, isn't it a clear flaw of the articulation of that math equation
Starting point is 00:08:40 that no one would write it that way? It's like, that's because pedmas is terrible. Like, you would communicate it with brackets or parentheses to, like, make your intent clear. And it's like, you don't need any of that for APL. You know, it's like, and this is an argument for APL. This is an argument against the order of evaluation that is necessitated by pedmas and bodmas or whatever. Well, there's particularly, the particular sort of poor candidate here is division, right? Because invariably, whenever you see this online, it's like the divide symbol, you know, the hyphen with two dots on either side.
Starting point is 00:09:17 And I don't know. Maybe it's just me, but I don't know. anyone who's used that symbol since grade school. Like, anyone who actually manipulates numbers like that and equations, they just write a fraction. You know, they'll use the other dimension. You know, computers, in some sense, for a while at least reduce this to kind of one-dimensional equations, and that was also a problem.
Starting point is 00:09:41 Yeah, it's true. You've just got the line. But in reality, nobody does that when they actually write things on paper or when they want to even, you know, type set a paper for me. mathematics, of course. Yeah, yeah. I mean, that's true. I mean, on my favorite calculator of all time, the, I believe, it's been years since I've
Starting point is 00:09:58 had one of these calculators, a Ti-30XS multi-view. I believe it has the ability to... Okay, you're wrong? You're wrong? This is the best calculator of all time. Ben was reaching for something. I was like, is he about to pull out the Ti-30XS multi-view? But no, it's a Casio.
Starting point is 00:10:16 This is the Cassio FX-150D. It's how, okay. hour, this episode started in like Toronto, Canada and ended up in like Tanzania. Why is this the best calculator? Well, it's, it is sort of peak non-graphical calculator, in my opinion. So I've had this calculator for 35 years. It's still working. It's solar powered.
Starting point is 00:10:48 It still works fine. What makes it very good in particular, the thing that I use it for, and sometimes still use it for, less so these days, but it has sort of one touch binary decimal hex conversion. That is really good. I don't think the 30XS multi-view has that. In fact, I'm sure if your calculator is pre-grafing calculator, it's got an order of magnitude more functionality. I'm just looking at the key set.
Starting point is 00:11:14 The main thing that was nice about the 30XS was for at least the actual. exams because it was an actuarially an S-O-A-approved calculator. It had the, you know, it would show you a square root or like a fraction. And a lot of times there are multiple choice questions actually have them in the pure form or whatever, not the rational floating point form. And you could also, and you could store stuff in variables as well, which I imagine yours, if yours is pre-grafing calculator, I'm sure they have that functionality. So that's another thing of like progress in mathematical education, right?
Starting point is 00:11:48 sometime when you're around, oh, I don't know when it might be 11, 12, there's a point where you need to learn when you're solving an equation, you know, if the answer is, let's say, root 3, just write root 3. Do not write the decimal. Oh, yeah. Right? The answer is root 3, that's fine. Yeah. Yeah, that's very true. I don't know at what point I went. And that also just made me think that the lies that we were told in our education, you know, I don't know why I did this, but every summer we would drive either north or south. I lived in the middle of nowhere in British Columbia, a city called Prince George. And so we'd always drive to visit my grandparents. One was in Terrace and one was in Vancouver. And each one is eight hours and one's ten hours. And sometimes I would just take math. I'd take a sheet of like loose leaf and like write some random math equation with X's and things.
Starting point is 00:12:40 And then I would just solve it. This is just something that passed the time. And every once in a while you end up with X squared. I'm like, you're like, oh, I put a bad combination. an incorrect combination at the top because it was before like grade eight when they taught you the quadratic formula and then I'm sitting in class one day and then teach you the quadratic formula and I was like, you're telling me this whole time there was a formula for solving this and I thought I was doing something wrong. What the hell? And I guess that's just an example
Starting point is 00:13:07 of not having gotten to that point yet. Yeah, the quadratic formula to me always feels like cheating. I don't know if it feels like it, but like because it feels like it feels impure. If I have to break out the quadratic formula to solve an equation, it means, usually it means that I'm looking for some real answer. Like, I'm looking for a decimal, you know, a real number. Like, that to begin with is somehow impure, maybe. But it feels like, you know, I don't know, breaking out the quadratic equation, it's fine, but it feels like, you know, it feels like taking sugar in your tea. Really? So you're not a big fan of the quad. Honestly, probably one of the best days of my education from like kindergarten to grade 12 was the day I learned the quadratic formula. I would much rather, I mean, it's expedient and it's fine and it's good, but aesthetically, I would much rather solve a quadratic equation by inspection or by completing the square or some other method rather than breaking out just having to full, it feels like a fullback.
Starting point is 00:14:16 It feels like I couldn't solve this by any other method, so I had to use the quadratic equation. I don't know. Maybe it's just me. Yeah, interesting. I've never, I've never, I mean, I guess it was my path to the quadratic formula. I had run into all these equations that I had mangled together myself and then this was the, and I guess I didn't have graph paper. I wasn't drawing these curves and then, you know, circling points and estimating. When I was in grade school, what age was I? Let's say 13, 12, 13, so second year of secondary school, I think it was.
Starting point is 00:14:52 I was lucky enough to have a recreational mathematics class on the syllabus. Once a week, one period, recreational mathematics. David Beckwith was the teacher. If you're out there, thank you very much. But it was a great class. And what made it great was just that it was, it was a class where the students, Firstly, we got to collaborate on problems, right, which is great, which normally you don't get to do because, you know, the structure of education means you have to be tested and you have to make sure that individually you know it. No, in the recreational mathematics class, the teacher would throw out a problem and solicit ideas from the class, right? And then over the course of two weeks, three weeks, the class would get towards a solution to the problem. and solve sub-problems long the way, maybe split into groups.
Starting point is 00:15:48 It was that kind of a class. Really, really good. I remember it to this day. That sounds very. I would have died for a class like that. Well, not die. I guess that's a bit, I would have. Well, I was about to say killed, but I also wouldn't have killed.
Starting point is 00:16:01 All these bad figure of speeches. An example problem would be he'd come into class and he'd say, you know, how many squares are there on a chessboard? And someone would put the hand up and say, of course, they're 64. And he'd say, okay, so you're counting the one. one by one squares. At that point, everyone's mind expands a little bit,
Starting point is 00:16:20 and they're like, oh my gosh. And so then we go away, we work on that problem, we come back with the answer. And then he says, well, what if the chess board had a side length of,
Starting point is 00:16:29 side length of N? Can you figure that out? We go away, we do that. And he's like, okay, what about now if it's rectangular? How many rectangles are there?
Starting point is 00:16:39 Not just squares. So that was the kind of way that the class proceeded, right? It was that kind of open-ended problem where you just keep adding generalizations or maybe you keep adding constraints and over time you know everyone's mind gets broadened what grade was this second year of secondary school so i'm going to find it hard to
Starting point is 00:17:00 answer your question because i don't know how grade numbers go and the school i went to did not use conventional grade numbers but it would be when i was 12 turning 13 okay so it's for i mean at least for canada i don't even know i assume america and other parts but we call that either junior high school, but it's like you've got three or four years left in your... Yeah, yeah, it's pre-high school, pre-U.S. High School, for sure. Pre-GCSE in the UK. Recreational math. I mean, recreational... We've talked about so many things now, you know, my complaints about a lot of stuff.
Starting point is 00:17:34 I mean, what is the... I mean, the... What did I write? What was my exact thing that I wrote in the email? It was algorithmic... Algorithmic truth we've mentioned, full-up on inverse plus scan, array box.dev which you pulled up. So yeah and then finally recreational math. The other thing about recreational math is
Starting point is 00:17:52 I grew up geeking out reading those kind of books which is like you know, amuse your friends and confound your enemies kind of things. You know and it's when you have kids it's great because you can you know blow their mind in all sorts of different ways with these silly little number
Starting point is 00:18:09 problems, you know. It's like the thing about you know take any three digit number reverse it, take it away from itself, or do the subtraction, then reverse and do the subtraction again. And you always, I think that's the algorithm. And you always get 1,089. Like it's just, it's a way.
Starting point is 00:18:30 And on the face of it, it looks amazing. It's like, you always get, you guessed my number? How did you do that? Well, you always get that. And the reason why you always get that is a structural property of the base 10 and the place value system, right? It's just the way it works out. Things like that. It's things like knowing, you know, knowing the decimal expansion of one seventh and that kind of cyclic. Cycical fraction. Right. Yeah, yeah, yeah. So, like, I went out to karaoke and there were seven of us,
Starting point is 00:19:00 and the bill at the end of the evening was $200. And someone says, how much is that per person? I say, well, it's 2857. And the hostess is reaching for a calculation. She's like, how do you know that so fast? Like, there's two seventh. 200 divided by 7 Yeah, it's funny because I always memorized the like to four digits one seventh and then for like years didn't I think I tweeted it out the day that I realized it
Starting point is 00:19:25 I was like just realized today because I was messing around an APL with like formatting I don't know seventh fractions that they all had the same character set and I was like who knew? And I thought I was like discovering something cool and then everyone on Twitter was like yeah here's the Wikipedia paid on cyclic fractions
Starting point is 00:19:41 and I was just like oh there's other like you know, obviously you know about 1 9th and 1 3rd and all those ones and 111 sure, sure. But 1 7th is to, what is it, six digits, 1, 1429, something, something. 1428-7. Yeah.
Starting point is 00:19:56 So that one's a lot harder to just like observe, right? And it's cyclic. And of course, if you multiply by 7, you get 9-999-999. Because the, you know, because it's repeating, the extra 1-7th of that part is cut off effectively. So yeah, it makes you look amazing to your friends
Starting point is 00:20:13 when you just have, you know, when numbers are, when you, who was it who said like, maybe it was fine, and maybe it was someone else, but it's like, or it was said of Romanovian that every, every, every number was his friend. Right. Right. So, you know, when you, when you, when you, when you think of numbers, not just as just the number that you've learned by road, but with, with, with all of it's a web of, of interactions with other numbers, like, those kind of things. Then that, that, that, that, that, that kind of thing is what recreational mathematics opens your mind to, I think. Yes. Yeah. What is it? What's the name of that movie that has... The Man New Infinity? Yeah, yeah, yeah, yeah, with Def Patel playing Ramonajon. Yeah, there's a scene in that movie. I thought for sure I had included that clip
Starting point is 00:20:59 in my sick P-CP con talk from like years ago where he gets out of the taxi and says, oh, what an unremarkable number. What are you talking about? Sorry, I'm late. Doughty cab driver got lost. Should have known for his number. And what was that? More a dull one. 1729. No, Hardy. It is a very interesting number.
Starting point is 00:21:21 It is the smallest number expressible as a sum of two cubes in two different ways. Oh, that, yes. Taxi cap numbers. The taxi cab numbers. 1729, which is like a nice little Easter egg because there's tons of folks. I think you, STL, Stefan Lowaway, he sneaks those in. Yeah, stuff like that. I don't remember.
Starting point is 00:21:39 I feel like maybe when I was super young, I used to have the birthday tricks where it's like take your birthday and do something to it, and then I can reverse engineer your birthday with some simple trick. But I don't fully remember if I actually, like, had any of those. I spend too much time in combinatorial logic land. And that is, that's a reason why I love, you know, because, I mean, one of the, I don't know if it is a through line through this conversation, because we've been, we've been.
Starting point is 00:22:03 All over the show. Yeah. Was it Papuskin dolls, the Russian dolls or whatever? Matrashka dolls? Matrashka dolls. You know, we're so many tangents deep on some of these that we might have lost sight of the algorithmic truth and the recreational algorithms and math is that that is why I love combinator logic so much is because, you know, on my quest for algorithmic truth in, you know,
Starting point is 00:22:27 criticizing adjacent difference and discovering unplus scan and all this stuff, you know, sometimes it feels like you have really found like the underlying generic. And that is, you know, the kind of the pursuit of generic programming as well is what is the most generic form of this algorithm, you know, there's a connection between generic programming and algorithms and whatnot. And combinator logic, it's like the purest form of anything that I've come across because it's just like composition patterns, you know, like it's so obvious when you're applying in some pattern, you know, a unary operation and a binary operation, it's like, well, clearly,
Starting point is 00:23:05 this is, there's no debating that this is the insert, you know, B1 combinator or I combinator or whatever. They've got fancy names, which is a whole other thing. It's like, well, that's the convention. Well, it's a terrible convention. And I think most people would agree it's a terrible convention because it doesn't mean anything. And it's like, whereas at least everybody knows pedmas. Anyways, there's something here, but it's just like it's the, it's the pursuit of this stuff that's like undeniably beautiful and there's like nothing below it. And to bring it back to APIs, you know, to bring back to an application here rather than pure mathematics. It's the same
Starting point is 00:23:39 kind of feeling, right? When you write a really nice piece of code, when you get an API correct, most of the code I write is C++. It's highly generic. It's mostly templates. And so I'm writing
Starting point is 00:23:55 a lot of function templates, and I'm writing a lot of thinking a lot about the concepts, right? The arguments have to fulfill. And so it does lead to surprising things, times. For example, I have an API where it does an I.O. And there's a read function and a right function. Okay. Now, now, the surprising thing is that, so, okay, so what does the right
Starting point is 00:24:19 function take? Well, being very generic, it takes a right specification, right? It takes, it takes, and the specification is data plus where to write it. Okay. Just staying very high level here. What does the read function take? Well, again, it takes a read specification, which is where to read from, right? Because it's going to produce the data. So what does the read function return? Well, you want to be able to write what you've just read. So the read function actually returns a right specification.
Starting point is 00:24:51 It takes in a read spec, which is locations from where to read, and it produces those locations tied together with the data that it read. And that is a right spec. So what this means is that if you include the read header, because it returns the right specification, it needs the definition of it, right? So somewhat surprisingly, the right specification definition is entailed by the reading, right? And not actually by the writing, because what the right function takes is not a concrete right specification, but something that fulfills a concept. It doesn't actually need the definition of a concrete thing, right? Because when you get to that level of generosity,
Starting point is 00:25:39 these are the kind of surprising effects you discover. There's asymmetry there. Yeah. Like, you would think that, you would think that, you know, right specification goes along with the right function. But that's not actually true. It goes along with the read function because that's what's returned, and therefore you need to know a concrete thing to return.
Starting point is 00:25:59 Just a small observation I had lately. Yeah, yeah. I mean, those are the things you end up thinking about when you're going for a walk or, or I don't know if it's the stuff that you're thinking about when you're going for a walk. But I spend an inordinate amount of time. Sometimes I'll be listening to a podcast and then even if it's, it is an interesting podcast. If there's something interesting that I was thinking about or designing, I have to turn the podcast off and just like, clearly my brain wants to think about whatever, that problem is there a better way to. Yeah, when your mind is quiet, I have a talk about that. I'm not sure it's very well grounded in fact, but it is an experiential talk I gave at our local meetup a while back, about this idea of bringing both sides of your mind to work on a problem. The talk was called the Blacksmith and the Gardner. Oh, yes.
Starting point is 00:26:47 These are two personas that we use in writing code. Like the Blacksmith is forging code trying to get the machine to Benthol will. The Gardner is the more subconscious side. of our brain, which is also working on the problem if we're working on the meaty problem over the course of some time, right? This is why stepping away from the machine is a good debugger. This is why going for a walk. This is why you realize the answer to the problem in the shower, right?
Starting point is 00:27:11 It's a cliche. But this idea that how can we think about both sides of our minds working on the problem, and it's the blacksmith and the gardener? Yeah. I mean, should we call it there? I mean, there's some other things we could chat about, but we might leave them. Yeah, yeah.
Starting point is 00:27:29 Maybe next time. Yeah, well, there's a bunch of stuff we can talk about, but one of the things that didn't end up because we ended up talking about stuff was that insights that you've come across from this kind of either recreational math or recreational algorithms or... This was Steppenoff's experience, right?
Starting point is 00:27:49 He told an anecdote about how he was ill. He had flu or something like he was ill in bed. He was sort of, you know, in that of consciousness kind of ill, kind of ill where you want to be just asleep the whole day. And he had this fever dream, I guess, where he saw, you know, basically what we now know is the fold algorithm in his head or accumulate. And he understood how this was not just a mechanical thing happening in the computer,
Starting point is 00:28:16 but an implementation of this mathematical idea, right? And in that moment, he saw how computer programs could be, he saw how generic programming could work, basically. Yeah. Well, I've never had a fever dream due to an illness, but one can hope that we'll be enlightened the way Steppenov was. I'm not sure. Have you ever had any similar experiences like that?
Starting point is 00:28:40 Luckily, I don't get very sick very often. But most of my good ideas, you know, my output cue for picking up the answers to problems, if you're like, is not necessarily in the shower or on a walk. but it's early, early in the morning when I wake up before the alarm and I'm just dozing and my mind has been dreaming about the problem or something and then I realize how to solve it. That's where I find my inspirations. Be sure to check these show notes either in your podcast app or at ADSP thepodcast.com
Starting point is 00:29:13 for links to anything we mentioned in today's episode as well as a link to a get-up discussion where you can leave thoughts, comments and questions. Thanks for listening. We hope you enjoyed and have a great day. I am the anti-brace. Ha ha ha ha ha ha ha.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.