Files
Lee Hanken 7c8efd2228 Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use
- Search episodes, transcripts, hosts, and series
- 4,511 episodes with metadata and transcripts
- Data loader with in-memory JSON storage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 10:54:13 +00:00

178 lines
16 KiB
Plaintext

Episode: 1143
Title: HPR1143: The N Days of Christmas? Intro to Recreational Math
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1143/hpr1143.mp3
Transcribed: 2025-10-17 19:43:22
---
Howdy folks, this is 5150 for Hacker Public Radio.
Remember how much fun we had last New Year's during the 13 hour live podcast and party?
We're gonna have twice as much fun this year celebrating the full 24 hours of New Year's Eve
with guests from your favorite podcast and hosts around the world.
You're invited to join in on Mumble when you can and listen on the live stream when you can't.
The details will be posted on www.HackerPublicRadio.org.
Hello and welcome to Hacker Public Radio. My name is Charles in New Jersey and this episode is called The End Days of Christmas.
Introduction to Recreational Math, part zero, calendar counting.
I think this is the first episode of Hacker Public Radio that contains a direct discussion of math topic.
So I'm gonna start easy on you.
There has been an episode that was an interview about software that helps you do math
and another episode about software that helps you teach math.
But I don't believe we've had an episode that contained a discussion of math in itself.
So here we go. Let's make history together.
Okay, this as the title indicates this episode is inspired by a traditional Christmas song that's proved that
there are some songs that just don't need to be recorded by William Schattener to be annoying.
It's a little repetitive and formulaic with that repeated reference to a partridge and a pear tree.
But it does involve a lot of reciting of numbers and countings and that's what we're gonna focus on today.
So what are the 12 days of Christmas? Well, I'm not really sure.
But it's a period that starts on Christmas day and runs through the day before the next season, which I think they call Epiphany.
It starts in January sometime.
Counting calendar days comes hard to people so we tend to use our fingers.
And it turns out that that's actually not a bad method mathematically and here's why.
For finger counting, let's say how do I count the 12 days? Well, let's start easy. Let's count five days.
And if I started in the first of the month, it's even easier. If I count the five days of New Year's Day, it's easy.
It's January 1, 2, 3, 4, and 5.
One, my thumb, two, my index finger, three, my salute finger, four, my ring finger, and five, my pinky finger.
One, two, three, four, five.
How does that do anything for me? Well, I'm setting up when I count on my hands, my fingers.
I'm setting up a one-to-one correspondence between the dates that I want to track or count.
And the counting numbers, natural numbers, one, two, three, four, five, and so on.
Now, if I have to go above five, I can use my other hand, and I get up to 10 fingers to use.
And in this case, I have more than 10, so I'm going to have to annex either additional hands, or I'll have to generalize my approach and find a way to either partition the problem, to break it down so I don't need more than 10 fingers.
Or create a more natural mapping so I can do the counting more efficiently.
So let's see how we would start with a day other than the first of the month, where the counting is a little bit more confusing.
So how about the five days of Christmas?
So Christmas Day gets one. There's my thumb.
And December 26, Boxing Day gets two.
The 27th gets three, 28th gets four, and 29th gets five.
I'm noticing a pattern here.
25 minus 24 is one.
26 minus 24 is two.
And in each case, the number that I'm assigning to each of the days in the series is the difference between that day's number and the number 24.
So I can see a way that I might be able to do this more efficiently by taking the, if I want to know which day in the sequence, at least when I'm within a month that I want, I just have to subtract the current day, the current day's date number from the base number.
What is the base number? Well, let's suppose I had a conference that I was attending that was five days long, and they asked me to speak on day four, and the conference begins on the 25th.
Well, if I try to jump ahead to what day four might be, and if I add four to 25, I'm into the 29th, and that's actually day five.
So I'll be a day late to speak.
But if I look at it again, and I add four days from the day of the pre-registration cocktail party, then I'll be adding one, two, three, four, four, day one, day two, day three, day four, and I'll be good.
So if I always start from the day of the cocktail party, instead of the day of the keynote, I should be safe when I'm doing this kind of math, at least when I'm, you know, when I'm starting in mid-month.
Of course, I'll always have to be careful, but that seems like a good method to use.
Now, if I use this logic, then if I have 12 days of Christmas, it should end on December 36.
Since December doesn't have 36 days, I'll have to actually partition this problem, so that I can count the first seven days.
So 31 is the last day of December, subtract 24, I've got seven.
So there's the first seven, and then I've got five days in January, and as we've already seen, one, two, three, four, five, we're done on January 5th, and we know what the 12 days of Christmas, what those dates are.
So we're good. So so far, we've learned finger counting, or to get fancy establishing a one-to-one correspondence with counting numbers.
We've learned how to annex, how to partition a problem into a couple of pieces, so we can solve two smaller problems that we can, that we do not solve.
And implicitly, I've done annexing by taking, you know, the days in December and in annexing January to extend the life of my holiday season or my longer conference to, you know, I've expanded the supply of days available, so that I'm covering the whole period.
So we've got a couple of fairly powerful features there, and I'll go over partitioning again, partitioning in annex and kind of go together.
I'm taking, when I don't have enough resources to do the count of this 12-day period in one month, then I partition those 12 days into the rest of the remaining days that are available to me in this month.
And I annex on January, so I partitioned it into two parts, and I borrowed from January to, to fit all of the days, or in general from the next month.
Okay, so I guess we've already seen that running out of December days for the 12 days is like running out of fingers on one hand when we're counting to eight.
We're so good at counting on our fingers that we don't recognize that act of partitioning the number eight between our two hands, so that the left hand gets one, two, three, four, and five.
And the right hand picks up the last three, six, seven, and eight.
We do it so naturally we don't even think about it anymore.
Now to keep counting even higher, we can either keep borrowing other people's hands, asking for volunteers, or we can track the number of times we reuse the two hands we have as we go by keeping a mark on a piece of paper or something like that.
The first method is what we would use in calendar math for really long periods by annexing extra months or even years if you have lots and lots of days.
The second is positional notation like that base 10 stuff that we learned in school, and I'm going to let you off the hook for that because I'm not going to go back to the positional stuff.
We're going to stick with the we're going to stick with the annexing and partitioning and finger counting because those are very powerful tools in themselves.
Okay, let's go back to the 12 days.
Let's see, I've pretty much covered this, but why not?
I've got these 12 days.
I've got date numbers that I want to assign, so I know that I've got 12.
So I'm going to assign one to so on up to 12 to a sequence of dates, even though, you know, I may be only interested in knowing the first and last dates at the beginning.
I may not want to be able to find out what days I'm going to which talks at a conference.
So I need to know how to do this kind of arithmetic all through it, all through the period.
So how do I start?
Well, I'm trying to figure out a general means of attack for this kind of problem.
Well, first I ask for how many I can fit into December of these 12 days.
I've already seen that the answer is 31 minus 24 or 7 days.
By finger math, that means I've mapped out 7 of the 12 days that leaves me 12 minus 7 or 5 days into January.
And I'm pretty sure that somebody can volunteer and tell me which days I would assign in January.
That's right.
January 1, 2, 3, 4, and 5, and the end date is the fifth day of January.
Okay, now let's generalize this just a little bit and ask, what if there were, say, 72 days of Christmas?
When would that end?
And I've got a note here to mention that we shouldn't worry, this is a purely hypothetical thing.
I'm not actually going to try to lobby for 72 days of Christmas or we'd all be going into rehab for Christmas overdose on day 73.
It's long enough before the holiday already.
We'd get sick of this music.
It would be a really, really long song.
So let's attack this with our arsenal of tools, finger math, with partitioning and annexing.
So December accounts for seven days, the 25th through 31st.
So that leaves 72 minus 7 or 65 days starting on January 1st.
An easier problem, not that much easier yet, but it gets easier as you go.
Now January easily picks up 31 days, 1 to 31.
I don't have to do much to figure that out because I'm starting with 1 and I'm used to starting with 1.
So that leaves me with 65 minus 31 days or 34 days starting from the first day of February.
And February has either 28 days, as next year, at the time this is recorded, or 29 days on a leap year.
So if there are 72 days of Christmas, it leaves us either on March 5th or March 6th, depending on whether it's a leap year or not.
So the final answer is that the 72 days of Christmas run from Christmas day itself until the following March 5th on a leap year or March 6th in any other year.
I guess it would be a good idea for us to check the answer, just to see if it's on the right day of the week.
And let's see, day 72 would end 10 weeks and two days after the opening cocktail party, which is on a Monday.
Christmas is on a Tuesday, let's assume, because I'm not sure.
And so day 72 would be on Wednesday.
Okay, that's just calculating from, you know, I can say the well, day 72 is exactly 10 weeks so that the day is not going to move there.
And then two days is my remainder. I'm backing off one to get to the opening cocktail party, add two and bang, I'm on Wednesday.
Let's see if it works.
Since next year is not a leap year, the last day in the 72 days of Christmas is March 6th.
By the Doomsday Perpetual Calendar Method, which I have a link in the show notes, don't worry.
February 28th, next year should be a Thursday.
Seven days into March would be March 7th, and that would be a Thursday as well.
So March 6th would be Wednesday and we were right.
If you want to rewind to verify that I said Wednesday in the first place, then you'll realize that this whole thing, it worked.
Or at least it's consistent.
And I'm off by an entire week if I'm off at all.
Okay, so why do I bother to do all this elaboration on calendar math?
Well, it teaches me a few skills that are going to be really important if I do either math or actually programming, which is of interest to hacker public radio listeners.
First, I learned to look at a problem that I don't necessarily know how to solve and partition it into smaller problems that are a little easier for me.
You saw how I took the 72 days of Christmas.
I chopped off the first seven because that fit in December, then I had a smaller problem starting with January 1.
And it's easier both because there is fewer days left and because it starts on the first of the month.
So that first partial month is really the hard part with a long stretch.
After that, you're dealing with whole numbers, you know, whole month units.
And the last partial month would be starting on the first, so it's really easy to calculate.
So the hard part is just, you know, getting that first partial month and then the rest of the problems that you've broken it into are really trivial.
So breaking down hard problems into smaller, easier problems.
Second, I learned the same kind of skills I'm going to need to debug what I guess it's easiest to call it off by one errors.
Where I've got a list of things and I'm trying to loop through them in some kind of a computer program.
And I either don't go all the way to the end of the list or I go off to the end. I go off the edge.
So I've actually gone to the meeting to speak on day four, but I arrived on day five and I meant to somebody else's time.
Well, and the same thing happens in an array if you've got something that's defined as a base location plus a size.
If that base location is zero-based, then if I add two big and offset, I'm into someone else's memory space.
And I might actually be trading on some part of the system that I need to keep my computer running.
These are both very bad things.
So knowing how to count things can help you avoid off by one errors, which is one of the, I believe it's one of the most common programming errors that you run into.
Certainly one of the more serious ones.
And finally, I'll never miss a speaking engagement where I've told the beginning date of the conference and the day that I'm speaking.
As long as I learn to count my conference days from the opening cocktail party instead of from the keynote.
And for some reason, I think the hacker public radio listeners will find that the cocktail party is slightly easier, easier to remember, although maybe not to remember what happened, then the keynote.
Although the keynote can be a really good nap, but I digress.
Okay, that's it for this episode.
Next episode, part one, we're going to actually count those gifts that are mentioned in the song about the 12 days of Christmas from the 12 part reaches in paratries to the 35 or 40 gold rings.
We'll learn how to count that next time.
All those things, I will warn you that there are two kind of semi-magic formulas at the end of that episode.
But I will show you a way to just do running songs in a spreadsheet and get the same answer without really having to do much work at all.
Besides, you can skip the formulas and I'll never know.
And since this is HPR and not school, we can actually let them up.
Okay, I'm Charles in New Jersey.
My contact information by email is cat-in-TP at Yahoo.com.
To spell that out, that would be what?
Charlie, Alpha, Tango, India, November, Tango, Papa at Yahoo.com.
It's actually my initials plus my Myers Briggs type.
And don't worry if you don't know what the Myers Briggs type means.
I probably don't either at this point in so many years.
But it's just a handle that I can get almost anywhere.
So there you go.
All right, well, thanks for listening.
And I'll catch you next time.
And I'll be looking forward to listening to your episode on Hacker Public Radio.
Thanks a lot.
You have been listening to Hacker Public Radio at Hacker Public Radio.
We are a community podcast network that releases shows every weekday and Monday through Friday.
Today's show, like all our shows, was contributed by a HPR listener like yourself.
If you ever consider recording a podcast, then visit our website to find out how easy it really is.
Hacker Public Radio was founded by the Digital Dark Pound and the Infonomicom Computer Club.
HPR is funded by the Binary Revolution at binref.com.
All binref projects are proudly sponsored by Lunar Pages.
From shared hosting to custom private clouds, go to LunarPages.com for all your hosting needs.
Unless otherwise stasis, today's show is released under a creative comments,
attribution, share a life, lead us all license.