## Saturday, April 6, 2013

### How big a number is 400!

The other day I was teaching permutations to my Algebra 2 students, and casually asked how many different arrangements are there for our whole school body to be placed for a picture. I don't know the exact number, but I typically use 400 for estimates (yes -- I make enough estimates for our school that I have a "typical"). I knew immediately that the answer was 400! (which is 400*399*398*...*3*2*1 for those of you who have never seen the ! notation before).

My problem was that I had no concept of just how big 400! really was.  How many digits long is that number?

My initial thinking was to simply type it in the calculator, but it was too big for my TI-84 to handle.  That meant it was more than 100 digits long -- but is it more than 400 digits long? 1000 digits?  How can I answer this?

Eventually I think logarithms will be the answer, but for now let's see if we can set some upper and lower limits on things.  Since each of the digits in the multiplication from 400 down to 1 is less than 3 digits long, then the whole product must be less than 400*3 or 1200 digits long.  Since most of the digits are 2 or more digits long, it's safe to assume it must be more than 400 digits long, but just how many are there?

More formally:
400! = 400*399*398*...*3*2*1 < 1000*1000*1000...  = 1000^400 = (10^3)^400 = 10^1200
400! = 400*399*398*...*12*11*10! > 10*10*10*...*10*10*10! = (10^390)*10!

Now logarithms are a tool our PreCalc students will be tackling this next week, and could be used to answer this question, and it all hinges on the product - sum property of logarithms:
A factorial is simply a lot of multiplications, which would translate into a giant sum of lots of logarithms:

That can be summarized (pun intended...) as:
$log\:400!=\sum_{n=1}^{400}log\:n$
This gives me something that my calculator CAN handle -- since instead of actually trying to display the number, it simply gives me the magnitude of the number. This can be typed into a TI-84 by typing:
sum(seq(log(N),N,1,400)) = 868.8
This means the number 400! is equal to 10^868.8 and is therefore 869 digits long.

A quick check on wolfram alpha verifies this:
(I'm sure some of you were asking "Why didn't he just do that in the first place?" to which I simply respond "Because I didn't have to! God gave me a brain and problem solving skills for a reason!")

As a follow up question -- can I predict how many zeroes are at the end of that number?  In factorials, zeroes come after every multiple of 5.  (Technically, I would need multiples of 2 as well, but there are plenty of those, and relatively fewer multiples of 5).

Up to 4! there are no zeroes:
1, 2, 6, 24,
Between 5! and 9! there is 1 zero:
120, 720, 5040, 40320, 362880
Between 10! and 14! there are 2 zeroes:
3628800, 39916800, 479001600, 6227020800, 87178291200
After that my calculator can't display them properly, but I hope you'll anticipate the pattern.

400 is the 400/5 80th multiple of 5, and so 400! is the first factorial to have 80 zeroes at the end of it.  A not-so-quick check on Wolfram Alpha's picture reveals that there are actually 33*3 or 99 zeroes.  Extras!?

That's because there are more multiples of 5 -- 25, 50, 75, ... 400 each contain 2 factors of 5, and 125, 250, 375 each contain three.  Counting these all up should reveal 99 factors of 5 (and way more factors of 2):
80 Multiples of 5: (5, 10, 15, ..., 390, 395, 400)
16 Multiples of 25: (25, 50, 75, ... 350, 375, 400)
3 Multiples of 125: (125, 250, 375)
99 total factors of 5 therefore 99 zeroes.

And for completeness (since I kept claiming there were way more factors of 2 than 5).
200 Multiples of 2
100 Multiples of 4
50 Multiples of 8
25 Multiples of 16
12 Multiples of 32
6 Multiples of 64
3 Multiples of 128
1 Multiple of 256:
397 Total factors of 2.

What this means is that the prime factorization of 400! contains (among other things) 2^397 and 5^99.
What's the largest prime in 400! is a question for a different night. (Oh, what the heck, why not:)

As I read through my facebook feed, I was struck with following picture:
Immediately -- shows how much of a dork I am -- I thought "I wonder what time this picture was taken?!"

You see, as the earth rotates around the sun, shadows rotate around the objects that form them. In the northern hemisphere, these shadows rotate clockwise -- which is why clockwise is clockwise. The first clocks ever made were sundials, made by people living in the North, and then clocks were built later.

I figured I should be able to figure out the angle of the shadow of the arch and use it to figure out what time of day the picture was taken.  I could also figure out the date the picture was taken by looking at the length of the shadow. You see, everyday the angle of the sun at a given time changes. Right now, during the spring, the sun is higher in the sky every day at a specific time, which makes shadows shorter. Measure your shadow at 11:00am today and measure it again tomorrow and it will be smaller!

So I found a map of St. Louis, and used Geogebra to figure out the angle of the shadow of the sun, and the length of the shadow.  After about five minutes, I had placed a point on the map that represented where I thought the top of the shadow was, and had drawn a vector from that point to the point that represented the top of the arch. I compared that with the scale of the map, and estimated the length of the shadow to be about 1,000 ft.  After looking on wikipedia, I knew the height of the arch, and a little trig revealed the altitude of the sun to be about 32 degrees.

In a few more minutes I had estimated the angle of the the vector and converted that into a compass heading, which gives me the azimuth of the sun of approximately 111 degrees.

I knew there is only two times a year where the sun has that exact altitude and azimuth, once in spring and again sometime in the fall -- and I took a chance that this picture was taken on spring break (reasonable enough right?). So I looked up the altitude and azimuth for the sun on the days during spring break:

Since the photo was tagged as uploaded on April 1* I started with that date, and found the following data in the table:
The first column is the time (AM), the second column is the altitude of the sun, and the third column is the azimuth of the sun.  I was disappointed that I didn't see my exact values in the table -- but I didn't expect to either, for two reasons:
1. I didn't know if this was the correct date -- the picture might have been uploaded that day but taken several days (or even a half a year?!) earlier.
2. There is some degree of uncertainty in my measurements. As I moved around the point where I thought the top of the shadow was, the angles varied somewhat. To be specific, they varied less than a degree more or less than my values, but that's significant enough to make my answers have to be estimates.

Let me treat each of these reasons separately.  Assuming the picture was actually taken on April 1, and my measurements were slightly off, I would estimate that the picture was taken around 8:34 am local time (I could be off by an hour if the website doesn't account for daylight-savings time, but I'm going to assume they were smart enough for that).

If I don't assume to know the date the picture was taken, and trust my measurements, I would argue that the picture wasn't actually taken on the 1st.  Looking at similar tables for other days, I get much closer altitude/azimuth combinations for a few days later:

If I had nothing else to go on, I would estimate the date/time of the picture was April 3, 8:33am.

Perhaps the photo takers will provide the true answer in the comments below?

*There was some discrepancy between my wife and I as to when the picture was actually uploaded onto Facebook. It was posted April 5th, "tagged" April 1, but I have reason to doubt the "tagged" date. Only time will tell who wins our little "argument" -- although regardless of who wins, I will probably lose -- right guys?  I love you honey!