If you've ever practiced determining the day of the week for any date in your head, especially if you've used one of my methods such as the version I teach in the Mental Gym or Day One, you've probably run into the fact that these methods really only work back to seemingly random dates, such as Sept. 14, 1752 or Oct. 15, 1582.

This is due to the switch from the Julian calendar to the Gregorian calendar, as well as the fact that the calendar calculation formulas are designed only to work with the latter. What if you'd like to calculate dates in the Julian calendar?

In today's post, you'll learn how to handle Julian dates all the way back to the 200s!

The first official switch from the Julian to the Gregorian calendar happened in 1582, as noted in the video below. October 4, 1582 was not followed by October 5, but by October 15, 1582, effectively skipping 10 days.

Great Britain made the switch to the Gregorian calendar by jumping from Sept. 2, 1752 to Sept. 14, 1752, effectively skipping 11 days. Since Great Britain and its colonies were the majority of the English-speaking world at the time, native English speakers use this date for the conversion. Here are the years various countries made the switch, and here are the specific switching dates by country.

Since the switch was made due to the inaccuracy of the Julian calendar, the question becomes one of how to compensate for the change? As mentioned above, the change in the 1500s was only 10 days, yet in the 1700s it was an 11-day change.

To start, take the given year, and drop the last (rightmost) 2 digits. For example, 1491 becomes 14, an 943 becomes 9. This century number, which we'll call *x*, can be used to find the number of days that need to be added to the Julian date, in order to get the corresponding Gregorian date.

**UPDATE (June 3, 2013):** *I've run across a much easier formula for determining the days needed to go from the Julian to the Gregorian calendar. I'll post the updated method here, and keep the method from the original post below the line.*

Once you've got the century digits as x, multiply it by 3. If 3x isn't already a multiple of 4, round it up to the next multiple of 4. Once you've done that, divide the number by 4, subtract 2, and you've got your answer!

For example, let's find the adjustment needed for the 1200s. In this case *x* = 12, and 12 × 3 = 36. 36 is already a multiple of 4, so there's no adjustment at this point. Finally, we divide by 4 and then subtract 2, so 36 ÷ 4 = 9, and 9 - 2 = 7. This means we add 7 days to Julian dates in the 1200s to get the corresponding Gregorian dates.

What about the 900s? 9 × 3 = 27, which isn't evenly divisible by 4, so we round it up to the next multiple of 4, which is 28. 28 ÷ 4 = 7, and 7 - 2 = 5, so we would add 5 days to any Julian date in the 900s to get the corrresponding Gregorian date.

Naturally, once you have the correct Gregorian date, you can use standard calendar formulas to get the day of the week for the given date.

Since I posted this on May 30, 2013, let's try the Julian date of May 30, 1013. What would the corresponding date be in the Gregorian calendar? 10 × 3 = 30, and we round 30 up to the next multiple of 4, which is 32. 32 ÷ 4 = 8, and 8 - 2 = 6. Now we add 6 days to May 30 to get May 36, or more accurately, June 5th (36 - 31 days in May = 5). If we double check with Wolfram|Alpha, we see that May 30th, 1013 in the Julian calendar is indeed June 5th, 1013 in the Gregorian calendar.

Once you have a Gregorian date, you can treat it as you would any other date in your system. With practice, you can now go back as far as the 200s, since the adjustment for the 200s is 0. You can actually go farther back, but the calculations have additional things you have to deal with, such as negative adjustments, and compensation for date with BC or BCE before them.

In performance, and with a little practice, you can buy yourself the extra time needed for this extra calculation by performing the calculation while explaining briefly about the Julian and Gregorian calendars. Practice with Julian dates, and you'll surprise yourself with a wider range on your calendar calculation abilities!

------

**ORINGAL POST:**

It's done with the following formula:

Those funny-looking brackets with an upside-down L-shape simply mean to round any fractional answer you get upwards. Mathematicians and programmers know this as the ceiling function.

As a simple first example, let's assume we're working with a date in the 1200s. For any such date, we drop the last 2 digits, leaving us with *x* = 12. First, subtract x from 16: 16 - 12 = 4. Next, divide that result by 4: 4 ÷ 4 = 1. Finally add that result to x again, and subtract 6: 1 + 12 - 6 = 13 - 6 = 7.

That result of 7 means that, for any date in the 1200s, we would need to add 7 days to the Julian calendar to get the corresponding Gregorian date. October 10, 1252 in the Julian calendar becomes October 17, 1252 in the Gregorian calendar.

Naturally, once you have the correct Gregorian date, you can use standard calendar formulas to get the day of the week for the given date.

That 1200s example worked out nicely because 4 divided by 4 comes out even. What about when we're dealing with a century that doesn't work out so neatly? Let's try a date in the 900s.

For the 900s, of course, *x* = 9, so let's start going through the formula again. The first step is 16 - 9 = 7. Next, we have to work out 7 ÷ 4. The exact mathematical answer is 1.75, but since the next step is to round up any fractional answers (remember the upside-down L-shaped brackets?) up, all you really need to know is that 7 ÷ 4 = “1 and some extra”. When you round this up, you get 2.

Now, you can work through the rest of the formula just as before: 2 + 9 - 6 = 11 - 6 = 5. So, for any date in the 900s, you would need to add 5 days to find the corresponding Gregorian date. For the 800s to the 1700s, here's the adjustment required for each century.

Since I posted this on May 30, 2013, let's try the Julian date of May 30, 1013. What would the corresponding date be in the Gregorian calendar? We know *x* = 10, so 16 - 10 = 6. Next, 6 ÷ 4 = 1 and some more, which rounds up to 2. 2 + 10 - 6 = 12 - 6 = 6, so we need to add 6 days to get the Gregorian date. May 30th + 6 days = May 36, or more accurately, June 5th.

## Changing Calendars Mentally

Published on Thursday, May 30, 2013 in calendar, math, memory, memory feats, self improvement, videos

## Repost: Gas Math

Published on Sunday, May 26, 2013 in math, money, products, self improvement, software

(Note: This is a repost, with some link updating and minor rewriting, from about this same time 5 years ago. I repost it because it has become relevant over this Memorial Day weekend.)

If you do math at all at the gas pump, it's probably either related to how many gallons you can get for a given amount of money, or how much money will be required to get a needed amount of gas. If you're willing to do a bit of math and planning before you go get your gas, you can actually work a surprising amount of real savings into the equation, as well.

How do you save on gas? The obvious first answer is to find the cheapest gas you can. My grandfather's method for this was to drive around looking station by station, but that only works well when you're sure you can find gas lower than 35 cents/gallon. Unsurprisingly, the internet is here to help! Sites such as fueleconomy.gov, FuelMeUp, and GasBuddy make short work of finding the lowest gas prices in your area.

Unless you find the cheapest gas in your immediate area, another question begins to raise its head at this point. Sure, if you go a little farther to that station with the cheap gas you can save some money, but if you factor in the gas you'll burn going the extra distance, and the added gas you'll require, are you really saving money? With the current level of gas prices, this isn't a trivial question.

Fortunately, Kimberly Crandell, better known as Science Mom, tackled the question of whether nearby expensive gas or cheaper gas across town was cheaper in July 2007.

As I've explained, there is some math involved, but there are only five different factors involved: The number of gallons needed, the gas mileage of the car, the cost of the closer (more expensive) gas, the cost of the farther (cheaper) gas, and the miles out of the way for the cheaper gas (Google Maps, Yahoo! Maps, or MapQuest will come in handy here). In the article, you learn the formulas to process this, and how to solve for the savings you'll get, as well as the break even points for cost per gallon, total gas gallons, and distance.

Understanding and working through the formulas is one thing, but how about if you would just like to get your answer and go? Once again, the internet is here to help. My favorite tool for this step is Instacalc, which I first mentioned in August 2007.

I've created an instacalc version of Kimberly Crandell's equations where all you have to do is plug in the five factors (remembering that the two prices requested are both price per gallon).

If you prefer, I've also created a metric version of this calculator, for readers in other countries. Whichever version you use, I hope this helps save you some money and that you find it useful!

Update: If you enjoy William Spaniel's Game Theory 101 videos, you'll enjoy his method of finding cheap gas without perfect information. This method, based on game theory, is equally mathematical, but requires fewer calculations.

## Please Excuse My Dear Aunt Sally

Published on Thursday, May 23, 2013 in fun, math, puzzles, Scam School, videos

The order of operations is one of those things in elementary school math that probably caused you great frustration.

The order of operations, as taught in the US, is: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. This is usually taught with a mnemonic, such as PEMDAS (the first letters), or “Please Excuse My Dear Aunt Sally” (the first letters with an easily remembered phrase). Elsewhere, you may have learned BEDMAS (B is for Brackets, same as parentheses), BODMAS (O is for Orders, same as exponents), or BIDMAS (I is for Indices, same as exponents).

Having dealt with them before, you may be glad that you finally mastered the order of operations. However, they do still hold quite a few surprises.

The first surprise is that, as explained in the minutephysics video below, the order of operations is wrong. More accurately, it's not so much wrong as it is a weak attempt to mechanize the logic of how to handle mathematical equations.

Once you think you've got a handle on the ideas behind the order of operations, it's time to put your understanding to the test.

In what they deem to be their hardest puzzle ever, Scam School challenges you in just this way. Below is a number puzzle in which all the numbers are provided for you. The challenge is to add in the right operations so that each set of numbers total 6. Watch the instructions up to about the 3:30 mark, and try and solve it without any of the hints given later.

I'm proud to say that I managed to get all 10 answers working on my own without hints. I did, however, come up with a different approach for the 8s. As long as you've already tried and either succeeded or given up, you can see my answer guilt-free.

As Diamond Jim Tyler and Brian Brushwood mention, this puzzle doesn't seem to have hit the states until now. It is a good one to have in your arsenal, especially once this episode is several months old. I can't be sure, of course, but I'd like to think Martin Gardner would've appreciated this puzzle.

## Mental Feat Performances

Published on Sunday, May 19, 2013 in Knight's Tour, magic squares, math, self improvement, videos

Yes, the methods of mental feats are very important step in mastering them, which is why I spend so much time on them.

However, once you have the method down, how you bring that ability to an audience in an entertaining way? In today's post, we'll show you a few performers who take these feats to that all-important next level.

Our first performer is Gerry McCambridge, doing the Knight's Tour in his TV show, *The Mentalist*. Note the importance he pays not only to the feat itself, but with making sure that everyone understands the challenge and the difficulty.

With chess, people already have a preconceived notion of intelligence and difficulty being involved. What about if you're doing a magic square, a feat which boils down to putting down numbers, then repeatedly adding them up? If you can make that entertaining, that's impressive. If you can bring an audience to a standing ovation with it, you know you've really got something!

We'll wrap this post up with a rare US TV appearance late Shakuntala Devi. She was a woman from India known for her mental calculation skills. In Ricky Jay's TV special, *Learned Pigs And Fireproof Women*, she does root extractions in an extraordinarily fast and impressive manner. For you poker fans, that young man on the computer is probably better known to you as Chris “Jesus” Ferguson.

The whole point of this post, of course, is not to get you to copy these performances directly, but to inspire you to think of what unique and different qualities you can bring to your own performances.

## Keeping Your Rights at Hand

Published on Thursday, May 16, 2013 in memory, memory feats, self improvement, site features, videos

Back in 2009, I spent a few posts examining mnemonics relating to the US Constitution.

I'm always lookout for better and more effective ways to remember things like this, so here's my latest discovery.

The original posts cover amendments 1-9 in one post, amendments 10-18 in another, and amendments 19-27 in the final one.

About 2 years ago, I posted Ron White's method of memorizing the Bill of Rights using parts of your body from the top of your head, down to the bottom of your feet:

I just ran across a new Bill of Rights mnemonic video recently. Instead of using the whole body, this one uses various hand arrangements involving 1 to 10 fingers for each of the corresponding amendments:

Some of the hand arrangements need some further explanation.

For the 4th amendment, prevention of unreasonable search and seizure, the 4 fingers are wrapped around the thumb just as you would if you were a police officer knocking on a door with a warrant.

The 9th amendment refers to rights not specifically mentioned in the Constitution. When you're holding 9 fingers out, one thumb is hidden, but everyone know it's still there, just like the rights that aren't mentioned.

For more information on memorizing the US constitution, check out the US Constitution section of the Memorize United States of America Facts post over in the Mental Gym.

## Even More Quick Snippets

Published on Sunday, May 12, 2013 in fun, magic, math, memory, memory feats, nim, playing cards, self improvement, snippets

Those of you in the US are probably spending Mother's Day honoring your mom, so I'll just sneak a wide variety of snippets in today, and you can check them out later.

• Jan Van Koningsveld, along with Robert Fountain, has released a new book that will be of interest to Grey Matters readers, titled, *The Mental Calculator's Handbook* (Amazon link). If you're not familiar with Jan Van Koningsveld, he was able to identify the day of the week for 78 dates in 1 minute at the World Memoriad. I haven't had a chance to read this book myself yet, but his reputation does suggest the book is worthwhile.

• Starting back in 2008, I kept track of assorted online timed quizzes, the type of quizzes that ask you how many Xs you can name in Y minutes. I found these so fun, useful, and challenging, I even developed my own timed quiz generator, and even posted several original timed quizzes created with it. However, sporcle.com, home to numerous timed quizzes (despite starting out as a sports forecasting site) has gone and outdone this. Not only can you create your own timed quizzes, you can also embed them on your own site now! Find a quiz you like, for example, this landlocked states quiz, go down to the info box below the quiz, and click on *Embed Quiz*. A pop-up will ask whether you want a wide or narrow window (minimum width is 580 pixels), and you will be given the proper embed code, which can be used in a manner similar to YouTube embed codes.

• For those of you who do the Fitch-Cheney card trick, as taught on Scam School or YouTube, Larry Franklin has posted a simple tutorial on using Excel to practice this routine. As long as you understand your favorite spreadsheet program well enough, it's also not hard to adapt. It will take a while to create in the first place, but once it's ready, it's fairly easy to use.

• One of the most useful card memory feats to learn is memorizing basic blackjack strategy. Over in reddit's LearnUselessTalents section, user Tommy_TSW posted an interesting approach for memorizing this using your favorite video game, movie, or TV characters. Basically, you create a battle scenario for every possible situation, and when the various cards come up, you simply recall the corresponding battle (and result). Depending on the particular variation of blackjack you're playing, basic strategy can change, so you might want to calculate the right moves using basic strategy calculators at places like Wizard of Odds or Online-Casinos.

• Fans of the game Nim will enjoy this online version, playable even on all mobile devices. It's standard Nim, meaning that the last person to remove a card is the winner. It's simple, straightforward, and a good way to practice solo.

## YouTublerone's Memory Technique Videos

Published on Sunday, May 05, 2013 in memory, self improvement, site features, videos

One of the basic, yet most useful, of all memory techniques is the Major System, a method of turning numbers into easily-recalled images.

While there is a bit of practice involved when initially learning it, once you have the system down, it's quite easy to use. I always keep an eye out for new tutorials on the Major System, and I've just found a new video series that teaches it quite well.

The series was recently posted by YouTube user WatchYouTublerone. First, he starts with the basic building blocks of the Major System:

There are several videos which follow this basic videos, each of which teach a group of 10 images built from the basics of the Major System. For example, here's the video for images from 0 to 9:

I've added all of these videos to the Major System YouTube playlist. In addition, there's also a special video for the numbers 00-09, for use as the ending numbers of 3 or more digit numbers, such as 100, 101, and so on.

Once you've got these basics down, WatchYouTublerone then teaches how to expand the Major System by combining it with the Memory Palace System:

I've added this video to the Loci/Journey/Roman Room playlist, where you can learn more about this technique.

Try learning these techniques, and then explore the rest of this Grey Matters site for an astounding number of uses for it!

## The Mystery of 24

Published on Thursday, May 02, 2013 in fun, math, site features

The other day, I ran across an unusual mathematical fact which I had never encountered before.

Take any prime number that's equal to or greater than 5, square it (multiply it by itself), and then subtract 1. The result will always be evenly divisible by 24! Now for the hard part: Why does that always work?

Let's take a look at closer at this with our favorite computational knowledge engine. Wolfram|Alpha accepts the command *prime[x]*, in which x is any whole number, and the prime command returns the xth prime number. For example, prime[1] returns 2, because 2 is the 1t prime number. Prime[2] returns 3, prime[3] returns 5, and so on.

We'll have Wolfram|Alpha take the 3rd through the 13th prime number, square each of them, subtract 1, and then divide by 24. Sure enough, every one of those is evenly divisibly by 24!

To find out why this happens, we need to break the problem down into its basic parts.

**Squaring and subtracting 1:** The first step in the problem, of course, is squaring and then subtracting 1. The mathematical way to write this is x^{2} - 1. Not only can this be factored, but it happens to be a very standard and simple problem known as factoring the difference of 2 squares.

Working this particular problem out, we get: x^{2} - 1 = (x + 1)(x - 1). In plain English, squaring any number x and subtracting 1 is the same as multiplying a number 1 greater than x by a number 1 less than x. As a practical example, 6^{2} - 1 = 36 - 1 = 35. Our factoring tells us we should be able to get the same answer by multiplying (6 + 1)(6 - 1) = (7)(5) = 35, so sure enough, that works!

Regular Grey Matters readers will recognize this principle from the *Squaring 2-Digit Numbers Mentally* tutorial in the Mental Gym.

Now that we've established that squaring a number and subtracting 1 is the same a multiplying the two numbers immediately above and below that number, it's time to examine the other parts of this problem.

**Using odd numbers:** Every prime number equal to or greater than 5 will be an odd number, of course. What happens as a result of starting with odd numbers?

When taking the numbers immediately above and below any whole odd number, you're naturally going to wind up with 2 even numbers with a difference of 2. If you start with 15, then you'll effectively be multiplying 14 by 16. Starting with 17 results in multiplying 16 by 18, and starting with 19 results in 18 by 20.

With 2 even numbers, it shouldn't be surprising that x^{2} - 1 will result in a number evenly divisible by 4. But if we take a closer look, there's something even more interesting to discover.

Every other multiple of 2 is also a multiple of 4. So, when you're multiplying any 2 even numbers with a difference of 2, you're always multiplying a multiple of 4 by a multiple of 2.

In other words, when starting with any odd number as x, and running it through the formula x^{2} - 1, you'll always wind up with a number which is evenly divisible by 8!

That may explain the 8, but 24 ÷ 8 = 3. Why does running prime numbers through x^{2} - 1 result in numbers divisible by 3, as well?

**Using prime numbers:** When considering any group of 3 consecutive whole numbers, exactly 1 of those numbers must be a multiple of 3. With 15, we're considering the numbers 14, 15, and 16, for example, and 15 is the only one of those which is divisible by 15.

However, when we limit our choice for x to prime numbers equal to or greater than 5, we're guaranteeing that our odd number itself will not be a multiple of 3. If it were, it wouldn't be a prime number by definition.

That means when we deal with the numbers immediately above and below a prime number, one of those even numbers must be a multiple of 3. Starting from 17, we're multiplying 16 by 18, and 18 is the multiple of 3. With 19, we're multiply 18 by 20, and with 23, we're multiplying 22 by 24.

Choosing prime numbers effectively forces us to multiply a multiple of 4 by a multiple of 2, and also requires that one of those even numbers be multiple of 3.

What the problem really boils down to is the request to choose any odd number x which isn't a multiple of 3, multiply (x + 1)(x - 1), and the result will always divisible by 24 for the reasons I've detailed above.

Since prime numbers equal to or greater than 5 all fit this definition, they will all work. The trick is that there are other odd numbers which will work, as well.

49, for example, isn't a prime number, yet it's still an odd number which isn't a multiple of 3. (49^{2} - 1)= (49 + 1)(49 - 1) = (50)(48) = 2400, and even without a calculator handy, I'm pretty sure that's evenly divisible by 24.

Sometimes, it's fun just to wander through the forest of mathematics, and discover treasures like this.