Category Archives: Math

July 2016: 5 Fridays, 5 Saturdays, 5 Sundays

As a curiosity or with claimed mystical significance, people have noted that July 2016 has five Fridays, five Saturdays, and five Sundays. Various claims have asserted that this is extremely rare or extremely common. It turns out there’s an average of one such combination per year. Most years have one of these combinations per year. Some have none, and the rest have two.

The Gregorian Calendar has 14 possible calendars: a common year starting on each day of the week, and a leap year starting on each day of the week. Let’s call them A through N: A starts on Sunday in a common year, B on Monday in a common year, and so on through N, starting on Saturday in a leap year.

The Gregorian Calendar repeats on a 400-year cycle: a leap year in every year divisible by 4, except for century years that aren’t divisible by 400. In a 400-year cycle, there are 97 leap years, which means there are 400*365 + 97 = 146,907 days. That’s also an exact multiple of 7, which means that every 400-year cycle starts on the same weekday. January 1, 2001, was a Monday (Calendar B), so January 1, 2401, will also be a Monday (Calendar B). Whatever pattern we find, it will repeat every 400 years.

A month with five Fridays, Saturdays, and Sundays can happen only in a 31-day month that starts on a Friday. If the month starts on Sunday through Thursday, there won’t be five Sundays. If it starts on Saturday, there won’t be five Fridays. If the month starts on a Friday but it doesn’t have 31 days, there won’t be five Sundays.

A 31-day month that starts on a Friday happens only in the following cases:

  • Calendar A, December
  • Calendar C, March
  • Calendar D, August
  • Calendar E, May
  • Calendar F, January and October
  • Calendar G, July
  • Calendar I, March
  • Calendar J, August
  • Calendar K, May
  • Calendar L, October
  • Calendar M, January, July
  • Calendar N, December

In other words, in any given year, there might be zero, one, or two months that have five Fridays, five Saturdays, and five Sundays.

How often does each of these calendars show up? Calendars A, B, D, F, and G come up 43 times each in a 400-year cycle. Calendars C and E, 44 times each. Calendars H and M, 15 times. I, L, and N, 13 times. J and K, 14 times.

Calendars B and H have no 5-Friday/Saturday/Sunday combos, and they make up 58 years in a 400-year cycle. Calendars F and M have two in the same year. They also make up 58 years. The remaining 284 years have one combo each. In other words, in 400 years, there’ll be 400 months that include this particular combination. That’s an average of one per year, but 14.5% of the time, there’ll be two in the same year, and 14.5% of the time, there’ll be none in a given year.

The verdict: Months with five Fridays, five Saturdays, and five Sundays are pretty common, averaging once per year.

Leave a comment

Filed under Math

Why Speeding Doesn’t Help: Math for Everyday Use

Some like to claim that math isn’t useful in everyday life. I offer up a little math for a practical situation: Does speeding really get you there faster?

By the way, I’m showing rounded results below, but I calculated the results before rounding.

Case #1: Local Road

A local road I often travel has a 45 mph speed limit and plenty of traffic lights. On a recent drive, I gathered some numbers. I drove 7.7 miles on this road, passing through 17 traffic lights. Other cars were on the road too, but traffic wasn’t heavy. The weather was fine for driving. My only delays were the traffic lights. I went 45-50 mph when I was rolling.

It took me just over 15 minutes to cover 7.7 miles. My average speed was only 30 mph (average speed = miles traveled / hours traveled), because when I’m stopped at a light, I’m going 0 mph. If I could have gone 45 the whole time, I’d have covered 7.7 miles in just over 10 minutes. In other words, those 17 traffic lights made my travel take 50% longer (15 minutes instead of 10 minutes).

What if I wanted to get my travel time down to 10 minutes instead of 15? How fast would I have to go?

Speeding in the car doesn’t make the traffic lights cycle any faster, so let’s guess for the moment that I’d still have 5 minutes of delay due to traffic lights, no matter how fast I went. That means I’d have to cover 7.7 miles in 5 minutes. Miles / hours = mph. 5 minutes = 5/60 hours = 0.083 hours. That leads to: 7.7 miles / 0.083 hours = 92.4 mph. I’d have to sustain a speed of 92.4 mph, more than double the speed limit! That’s impossible on that road, and it would be insane to try.

What if I could sustain 55 mph? That would have been hard on this trip, because of other cars. I’d have had to weave aggressively to get through, and I still probably would have spent some time behind cars going under 55. But if I could have done it, it would have taken 8.4 minutes to drive 7.7 miles. Add in the 5 minutes of delay for traffic lights, and I’ve gotten my 15-minute drive down to 13.4 minutes. In other words, aggressive driving would have saved me only a little time.

In fact, the delays due to traffic lights might have gone up if I went 55 mph. Those 17 lights weren’t all for major intersections. Many of them were for little side streets; most of those lights were green when I got to them. If they’re sequenced for 45 mph traffic, speeding just means I rush to the next red light, which won’t turn green until the 45 mph traffic catches up. Aggressive driving might not save me any time at all, if every red light means the slower drivers catch up with me again.

Case #2: Beltway

To get to one brother’s house, I use the Capital Beltway. According to mapping sites, the drive should take 29 minutes to travel 17.3 miles. That’s realistic. Average mph = miles / hours, and 29 minutes is 0.483 hours, so 17.3 / 0.483 = 35.8 mph. That’s slower than one might expect, considering that over half of the distance is on a 55 mph highway, but it’s correct.

Let’s say, though, that this time I’m leaving the house 5 minutes later than I intended. I want to make up for it by speeding on the Beltway. The mapping site says I’d have 9.5 miles on the Beltway. At 55 mph, I’d take 10.4 minutes to cover the distance. How fast would I need to go get that down to 5.4 minutes? 5.4 minutes = 0.09 hours. Mph = miles / hours, so 9.5 miles / 0.09 hours = 105.6 mph. I’d have to average over 100 mph on the Beltway, just to get to my brother’s house a few minutes earlier. If you’ve ever driven on the Beltway, you’d know it’s insane or impossible to go that fast. And that’s just to get there at 2:00 instead of 2:05. Not worth it.

Case #3: Interstates

Now I want to drive to Williamsburg, Virginia, so my wife and I can have a nice weekend getaway. We’ve picked out a hotel. The mapping sites tell me it’s 171 miles of driving, and it should take 2 hours and 49 minutes. Most of the driving will be on interstates, where the speed limit will be 55 mph and up.

Let’s take a closer look at the directions and see how much time and distance will be on the interstates. I’d travel 3.9 miles (10 minutes) before I get to a highway. At the other end of the trip, I’d spend 2.8 miles (7 minutes) off the interstates. Everything in between is on interstates. That leaves 171 miles – 3.9 miles – 2.8 miles = 164.3 miles on the interstates, and 2 hours 49 minutes – 10 minutes – 7 minutes = 2 hours 32 minutes of traveling on the interstates. Traveling 164.3 miles in 2 hours and 32 minutes gives an average speed of 64.9 mph on the highways.

How much time can we gain by speeding on the interstates?

If we travel 10% faster, the 64.9 mph would become 71.3 mph. Could we average that much speed on over 150 miles of highway? I’m not so sure, but if we could, the 2 hours and 32 minutes would drop to 2 hours and 18 minutes. By averaging more than 70 mph over a long distance, we could save a mere 14 minutes. Would an extra 14 minutes open up new opportunities for enjoying Williamsburg? Nope.

Besides, what are the chances of averaging that much speed? Pretty low. If you’ve ever driven on I-95 between DC and Richmond, or I-295 around Richmond, or I-64 between Richmond and Williamsburg, you know that traffic jams are a very real possibility. We’d have to average more than 70 mph. In other words, if we’re stuck at slower speeds for some of the time, we’d have to go way faster than 70 mph to make up for it. Occasionally hitting 70 wouldn’t be enough. And this is all to save a measly 14 minutes. It doesn’t seem worth it.

Do the Math: Speeding Doesn’t Help

There you have it. Three different situations, and speeding makes no significant difference in any of them. Speeding might feel like you’re making better progress, but when you factor in traffic lights, traffic volume, and the fact that speeding is really only a few percentage points above the speed limit anyway, the math shows that speeding doesn’t make a big difference in travel time. Thank you, math.



Leave a comment

Filed under Math

6 + 1 x 0 + 2 / 2 = ?

It’s 7. It’s not 1, or 0, or 5, or 3.5, or any of the other answers people have imagined. This has been going round and round on Facebook, with over 300,000 responses last time I looked. Sadly, most of the answers are wrong.

There’s a thing called order of operations. Arithmetic isn’t a matter of opinion or voting. There’s a memory aid — Please Excuse My Dear Aunt Sally — to help one remember the right sequence: parentheses, exponents, multiplication and division, addition and subtraction.

Let’s apply that to 6 + 1 x 0 + 2 / 2:

  1. No parentheses. Move on.
  2. No exponents. Move on.
  3. Multiplication and division: 1 x 0 = 0 and 2 / 2 = 1. Now, our exotic puzzle becomes 6 + 0 + 1.
  4. Addition and subtraction: 6 + 0 + 1 = 7.

Smart and Stupid Calculators

My iPhone’s calculator app comes up with 7 because it uses the proper order of operations.

The calculator app on Windows 7 comes up with 7 because it also uses the proper order of operations.

My TI calculator from 20+ years ago gets 7. It, too, uses the proper order of operations. (Yep, I still have an old calculator, and it still works.)

However, I’ve seen cheap calculators that use the wrong order of operations. They act like everything is from left to right, no matter what. You enter 6 + 1, and they immediately show 7. Multiply by 0 and you get 0. Add 2 and you get 2. Divide by 2 and you get 1. I imagine this is why 1 is a popular answer, when people assume all arithmetic is strictly left to right, or they’ve been misled by a stupid calculator.

Counting Cookies

Here’s an illustration of why multiplication and division come before addition and subtraction.

Let’s say I’m counting my cookie intake over the last month. On 5 occasions, say I had 3 chocolate chip cookies: 5 times, 3 cookies, or 5 x 3. On 3 occasions, I had 2 oatmeal raisin cookies: 3 times, 2 cookies, or 3 x 2.

5 x 3 + 3 x 2 = ?

Do you think I had 21 cookies, or 36 (or some other number)? The correct answer, certainly, is that I had 21 cookies: 5 x 3 = 15 chocolate chip cookies, plus 3 x 2 = 6  oatmeal raisin cookies, for a total of 21 cookies.

If you do the arithmetic in the wrong order, like strictly left to right, you’d think I had 36 cookies. 5 times, 3 cookies = 15 so far. 15 cookies + the 3 times I had oatmeal raisin = 18 cookies so far. (Makes no sense now, right?) 18 cookies, times 2 for the two times I had oatmeal raisin = 36. Wrong!

If you think 5 x 3 + 3 x 2 = 36, try laying out pennies. Take 5 sets of 3, and then 3 sets of 2, and then count how many pennies you’ve laid out. You’ll get 21, not 36.

Or say the problem in a different order, oatmeal raisin before chocolate chip. 3 times, I had 2 oatmeal raisin cookies. 5 times, I had 3 chocolate chip cookies.

3 x 2 + 5 x 3 = ?

If you follow the proper order of operations, you’ll find that I had 21 cookies, same as before. If you pretend arithmetic always runs left to right, you get a different answer this time: 3 x 2 = 6, 6 + 5 = 11, 11 x 3 = 33.

If strict left-to-right arithmetic was correct, then I had either 36 or 33 cookies, depending on which cookies you count first. Does that convince you?

Vending Machines Help Make the Point

You go to a vending machine. The item you want costs 75 cents. You put in 2 quarters, 2 dimes, and a nickel. Does that add up to 75 cents? Only if you follow the correct order of operations.

2 x 25 + 2 x 10 + 1 x 5 = ?

The correct order of operations has us do the multiplications before the additions: 2 x 25 = 50, and 2 x 10 = 20, and 1 x 5 = 5. Then we add up 50 + 20 + 5 and get 75.

If you think arithmetic is only left to right, you’d get 2 x 25 = 50, plus 2 = 52, times 10 = 520, plus 1 = 521, times 5 = 2,605.

Which is it? Do you think 2 quarters, 2 dimes, and a nickel add up to 75 cents, or $26.05?

Now switch the order. If you take those same coins, but you put in the 2 dimes, the nickel, and then the 2 quarters, is it still 75 cents?

2 x 10 + 1 x 5 + 2 x 25 = ?

Of course it’s still 75 cents. The correct order of operations says so: 2 x 10 = 20, and 1 x 5 = 5, and 2 x 25 = 50. Then 20 + 5 + 50 = 75 cents.

If you use left-to-right order instead of the correct order: 2 x 10 = 20, plus 1 = 21, times 5 = 105, plus 2 = 107, times 25 = 2,675. You’d think you had put $26.75 into the machine this time, instead of $26.05 when you started with the quarters.

If you believe your two quarters, two dimes, and one nickel add up to 75 cents in any order, you just made a case for using the correct order of operations.

And that’s my $0.02.



Filed under Math

Why I Don’t Have 1.6 Novemdecillion Ancestors

I was going to call this “Fun with Genealogy, Math, and Data” but then I’d have even fewer readers. (Darn, I said it! There go the readers!)

Lots of Boxes in the Family Tree

The odd thing about family trees is that the number of people gets larger as you go back through the generations, but the population of the world is smaller as you go back through the generations. If my family tree had no repetition, meaning that every spot in the tree held a different person, I’d have 1.6 novemdecillion ancestors by the time you go back to about 4000 BCE. That’s 16 followed by 59 zeros, which is vastly, hugely, astronomically more than the world population 6000 years ago of around 7 million people. It’s vastly more than the estimated number of stars in the universe.

The explanation, of course, is that a family tree must have tons of repetition when you go that far back. Somewhere back in ancient Europe, where DNA testing places my heritage, there are couples who must show up trillions of trillions of times in my family tree.

The Crossover Point

The next question is: Where’s the crossing point between the size of my family tree and the population of the world? At which generation in the family tree does the size of that generation exceed the world population? It turns out to fall somewhere around the year 1100. I’m estimating 30 years per generation. Look back 28 generations before my year of birth and we hit the year 1118. That 28th generation of the family tree has more than a quarter of a million people in it. The world population back then was a little more than that, somewhere around 320 million. Look back 29 generations to about 1088, and we’ve got over half a billion people in the family tree, but the world population was smaller than that. That’s the crossover, then. Somewhere around the turn of the 12th century, my family tree is larger than the population of the world. There are more spots to fill than people to fill them.

What does that mean? Although anyone could have repetition in the family tree more recently than that, it’s guaranteed to happen by the time you reach back to the Middle Ages. It also means that if your ancestors and a friend’s ancestors were from the same general region back then, there’s a very real possibility that you’re very distant cousins. If two people today have an ancestor in common from 29 generations ago, they’re 28th cousins.

That crossover point is where your family tree must have repetitions. Most likely, you’ve got repetitions that are much more recent, because you’re not descended from everyone who was alive back then. Some of those people didn’t have kids, or didn’t have family lines that survived until the present day, and some simply aren’t your ancestors.

Repetition in Our Family Trees

Both my wife and I have known repetitions in our family trees. Phillip Harmon (1803-1853) and Nancy Jackson (1801-1885) are my 4th great-grandparents in two different places. Their daughter’s son married their son’s daughter – cousin married cousin – back in southern Indiana. In my wife’s family tree, Pierre Georges Riffaud (1834-1890) and Marie Elisabeth Zélie (1833-1893) are her great-great-grandparents twice over (life on a small island, Martinique). Two of their descendants got married and became my wife’s ancestors.

We also found potential common ancestors in medieval Europe (because European nobility and royalty kept careful track of their lineage). Our evidence isn’t rock solid every step of the way, but it’s mostly pretty good, so we might well be distant cousins through some medieval ancestor. The math above makes this a rather unsurprising result. Just about all of European royalty was descended from Charlemagne, and there’s a decent chance that if you have European heritage, you’re descended from some European royal too, and therefore also from Charlemagne. If you have French heritage in particular, you’re probably descended from Charlemagne. Roughly 30% of today’s African-Americans also have European ancestry, so if you’re descended from slaves in the US, you too could be one of Charlemagne’s descendants.

If you are indeed descended from Charlemagne, you’ve got lots of repetition in your family tree. If he’s there at all, he’s probably there in multiple places.

30 Years per Generation?

Earlier, I estimated 30 years per generation. That’s a common genealogical estimate, but can we test it? Sure, with more math and more data! Yay! The average generation interval between an ancestor and a descendant is: (descendant’s birth year – ancestor’s birth year) / (number of generations between them). My 3rd great-grandfather Mathias Becker was born in 1814. I was born in 1958. That’s (1958 – 1814)/5 = 28.8 years. That’s one line. When I average out the 4 generations behind our kids, I get 30.4 years. Our family trees have complete birth info on everyone for those 4 generations. Our info gets more sparse as you go back. When I average what we have for 5 generations, I get 30.6 years. When I throw in the 6th generation, where the birth dates fall in the late 18th century, I get an average of 29.8 years. Those averages are all in the neighborhood of 30 years, so the estimate seems like a decent one, at least for the last few centuries of European heritage.

To go back farther in time, I looked at the oldest line I could trace with any kind of data, to Pepin of Landen, Charlemagne’s 3rd great-grandfather. (Once your family tree ties into European royalty, the family tree grows a lot.) For the sake of the exercise, let’s accept the path leading to dear old Pepin without pointing out where the weak links are, and see what this does to the average generation interval. He was born in about the year 580. In the family tree data we’ve accumulated, he shows up 24 times as an ancestor of my kids: 4 times as their 41st great-grandfather, 15 times as 42nd, and 5 times as 43rd. He’s 43-45 generations behind my kids. Five of those 24 ancestral spots are on my wife’s side, 19 on mine. He’s probably there in a lot more places that we don’t know about.

For my youngest, the average generation interval between her and Pepin of Landen is 31.4, 32.1, or 32.8 years, depending on the path you take. A rule of thumb of 30 years per generation still seems about right, all the way back to the early Middle Ages.

Genealogy. Math. Data.

Genealogy. Math. Data. This is how I have fun.

Thank you both for listening.


Leave a comment

Filed under Genealogy, Math