Nice explanation. Small comment: At 22:40 to solve the congruence you can simply divide both sides by 2 because 4 is divisible by 2 :). You really only need to use the multiplicative inverse to solve a congruence when the right side is not a multiple of the coefficient on the left. Alternatively, for small numbers, you can find a congruent number that is a multiple of the coefficient. For example, to solve 3x=7 (mod 13), you can use that 7 is congruent to 33 (=7+2*13) modulo 13, so the solution is 33/3=11 (mod 13).
To comment on the "sketchy part" where we approximate log_10(1000!) using Stirling's approximation, the wikipedia page for Stirling's approximation gives explicit bounds, which could be used. In the introductory section one such bound is already given: for any integer n >= 1, n! = c sqrt(2pi n) (n/e)^n for some c between e^{1/(12n+1)) and e^(1/12n). Taking logs on both sides, we observe that ln(n!) is ln(sqrt(2pi n) (n/e)^n) + r, where r is going to be between 1/(12n+1) and 1/12n. For large n this error r is going to be very small and hence as long as the fractional part of the actual approximation is not too large (less than 1 - 1/12n) flooring the result gives you the correct integer. (For simplicity I worked with ln instead of log_10, doing it log_10 in fact gives an even better range)
Indeed, as long as log_10 of Stirling is not *too* close to an integer, we're in good shape. One might however wonder how bad approximations like pi² ~ 10 or e^3~20 are
But that's CHEATING right because if you don't know Stirling you cannot deduce it so there's no way to solve this problem right? I can't see any..o ly how to solve how many zeroes and that the last digit before the zeroes will be an even number so 2, 4 ,6 or 8
I barely recognised it! In statistical mechanics, _log(n!) = n log(n) - n_ was always good enough, no need to get constants involved. I guess the difference is working with _n_ being about 10^20 rather than 10^3.
I know someone who called himself TypoKnig well over a decade ago. He was a big Grateful Dead fan and an extremely sharp wit. I think he'd be a little upset that a physicist is using his name while typing sentences containing no typos at all.
First, the "fact" counting the number of digits needs to be updated to 1+floor(log10(N)). Second, the digit sketchiness is quickly removed by using the improved version of Robbins (see Wikipedia entry on Stirling's approximation): s(n) * exp(1/(12*n+1) < n! < s(n) * exp(1/(12*n)), where s(n) is the Stirling formula. Under log10 for n=1000 this becomes a tiny additive interval that does not change the estimated number of digits.
11:43 There is actually a little problem here that lies in substitution cbrooot(20) instead of e. Just because log2(e) is multiplied by 1000 this approximation is not well enough. So the overall result in this approach will be a bit different (2569 instead of 2568)
You can also skip the mod 5 transformation at the end, note that 2^n mod 10 is a repeating sequence (2, 4, 8, 6, 2, 4, 8, 6, ...) which leads to the same reduction of 2^248 but still modulo 10. Then you have 2a=4 (mod 10), with two candidate solutions, a=2 and a=7
Ran it, got 2 quicker than 1 second? But Wolfram Alpha is even easier: 2319 digit of 1000! returns 2 then you can get last digit of: last digit of 1000!/5^249 returns 4 🤣
I'd like to see you do a piece on spinor but when you flip, instead of clearing the board it takes all the spinor respresentations and introduces a factor of -1.
Here an alternative solution for the second part, based on the fact that for finding a trailing decimal digit we only have to look at the trailing digits of the factors: after removing all 249 "10"s, we have 997 - 249 = 745 remaining "2"s. And the power table for 2 mod 10 tells us that 2^745 has a trailing digit of "2", since 2^(1+4n) always ends with "2". And this 2^745 gets multiplied by some odd number not divisible by 5, so we now have to find the trailing digit of this odd number. To find it, we only have to count the number of all factors that end with "3", "7" and "9" resp.. We can omit "1" because it doesn't change anything. And there are exactly 100 factors in 1000! that end with "3", 100 factors that end with "7" and 100 factors that end with "9". The power table for 3 mod 10 tells us that 3^100 ends with "1" - since 3^(4n) always ends with "1" -, the power table of 7 tells us that 7^100 ends with "1" and the power table of 9 tells us that 9^100 also ends with "1". And there we have the solution, the digit we are looking for must be congruent 2 * 1 * 1 * 1 mod 10, i.e. it must be "2".
I think you are forgetting numbers that comes from factoring 2 and 5 out, like 6 -> 2*3 and 15 -> 5*3, those would contribute to the last digit after factoring 2 and 5 out
@@59de44955ebddoesn't it still work ans what do tou mean by power tables..ive never heard of that..whete did tou learn that..because after you factor put all the 2s you are left with terms ending in odd numbers so isn't your method correct?
Clever grouping at the end there. My immediate thought was to find the prime factorization of 1000!, which uses the same floor(n/p)+floor(n/p^2)+..., but that needs doing work on all the primes up to 1000, so I'd need a computer to get the answer from that point. And if I'm using a computer, I can already cheat and just like you said, just calculate 1000!.
I read the title but the with the "!" as an exclamation sign: "amazing! we are going to show you the 2319th digit of a 4 digit natural number: 1000" and I was like 🤔🤔 "1000.000.... and the 2319th is ZERO"
I'd never heard of Sterling's formula, but I'm proud of myself for getting floor(1000!/p^k) just having seen the thumbnail. I got it from the other side, considering powers of 2 first. I'd considered finding the length of 1000! by summing log(1000) + log(999) + ... + log(1) using a computer, since I couldn't think of a way to group the factors.
You could try to estimate this sum by noting that it should be relatively close to the integral of log(x) from 1 to 1001. This integral unfortunately is equal to 2568.70, so after adding the 1 from the 1 + log(N)-formula and rounding down (we know we are overestimating), we get that it has roughly 2569 digits, one off the actual digit count. We could also actually note that the integral of log(x) from 1 to 1000 would slightly underestimate the sum log(2) + log(3) + ... + log(1000), which is the same as the sum we're looking for (as log(1) = 0 anyway), but this integral is equal to 2565.70, so after adding the 1 from the 1+log(N)-formula and rounding up, we get that it has roughly 2567 digits, again one off the actual digit count. This would tell us that the actual digit count would have to be 2567, 2568, or 2569. We could now check that the difference between the sum log(1)+log(2)+log(3)+log(4)+log(5) and the integral of log(x) from 1 to 5 is greater than 0.3, so the error we do must be larger than 0.3 and the sum should therefore be larger than 2566, and therefore eliminate 2567 as an option. To eliminate 2569 in the same way, we'd have to unfortunately find the difference between the sum of the first 21 terms and the integral from 1 to 22, so this would be harder to eliminate in this way.
You probably know this but there are more accurate versions of Sterling's formula. I have seen it as an infinite series so if you take more terms you will get higher precision.
Python can do this C# also , C# needs to save source file but compiler and virtual machine which interprets CIL code has been already installed in Windows and you dont need to install extra software
It's an act of faith, or at least an act in hope, that the target digit is the last that's not a zero. Had the target been to the right, then the solution would be zero, with less work. But had the target been MANY DIGITS to the left of the last non-zero digit, I'm not sure that we'd be much closer to the goal. (words in caps added for clarity)
In that case, we do Part II of the analysis in "modulo 100" instead of "modulo 10". (This answer of mine is under the presumption that "to the left" means "directly to the left (of the last non-zero digit)" , rather than "in some specific position to the left (of the last non-zero digit)".)
@@yurenchu you've completely missed my point. When you start work on the question, you don't know where the last non zero digit is So you don't know if you'll land on the zeroes, or on the magic digit, not on the digit you are thinking of ... Yeah, and thenif it turns out that it's seven to the left of the last one we can do the analysis using mod 100,000,000. Hardly a short cut. By assuming "immediately to the left" you are still setting out as an act of faith/hope. And my point is that it's an *unjustified* assumption, and you are merely hoping that it will lead (after an initial investment of several lines of working) to a viable short cut. In some situations you might be justified in assuming that the examiner is being kind to you: that's an act of faith, not of mathematics. Or you might simply be hoping. Suppose you don't get lucky: suppose it's the digit where you have to take mod 10,000,000 or suchlike?
@@trueriver1950 The thing about math is, you have to be willing to test out the all kinds of lengthy analysis to go anywhere meaningful and unexplored. Which is why many math profesors encorage and appreciate work that is done 'tediously' or 'brute force', (even more than clever solutions), to reinforce the sentiment in the heads of their students. If you dont get lucky, you try something else. AND dont get hung over thinking that your hypothesis might be wrong and the work you put in could be in vain. Many a times the work you put in will help you determine the correct the path or state for tackling the problem.
I tried and failed to solve this problem when I was an undergrad, I never knew that floor formula. It's sort of obviously right, from your explanation, and the right tool for the job, too.
Only having seen the title my guess would be the 2319th digit could be one of the many zeroes already? There have to be a bit more than 250 zeroes at the end (because every multiple of five ends up giving us one of the zeroes) So if 1000! is about 2500 digits long the 2319th could still be one of those trailing zeroes.
Alright having seen the video 1. "a bit more than 250 zeroes" was too careless, I added the 200 fives + 40 twentyfives and reasoned there would be a few more 2. Unexpected backflip! 3. Your focus on the even digit in the middle makes me think that's gonna be our target number :O 4. 2568 - 2319 == 249 :D I guess that means I was wrong 5. Expected backflip! That was some cool math, especially to find that last digit, even if my "easy"(/guesswork) solution was wrong once again :P
I got a question, which is probably stupid but from a simple observation, we can see, that in the denominator, we took 5 instead of 10, which is factor 1/2 of the original base 10. We easily compute 4. Now, we determine the real modulo (that is: the searched digit), can't we just use the factor 1/2 to compute the real modulo 4*1/2 = 2? Or is that that just a coincidence here? I don't know why, but this is the first maths video, I actually watched through till the end. I'll leave it as a compliment here for a good video! :D
Will this work? I got 0. Count the number of 0s at the end of 1000! This can be done by counting the number of 5s in 1000!, since every power of 5 contributes a 0 to the end of the factorial. We can use the following formula to count the number of 5s in 1000!: floor(1000 / 5) + floor(1000 / 25) + floor(1000 / 125) + floor(1000 / 625) This gives us a value of 200 + 40 + 8 + 1 = 249. Divide 2319 by 249. This gives us a quotient of 9 and a remainder of 147. The remainder of 147 tells us that the 2319th digit of 1000! is the 148th digit of the number 10000...00147 (where there are 200 0s after the 1). The 148th digit of this number is 0, so the 2319th digit of 1000! is also 0.
Dear Prof Penn, I am a fan from Lahore. It is good to know that you are in great health and can flip so effortlessly. However, please do it rarely and only in a few videos with proper protection. I feel anxious and nervous that if you do it too often as you might hurt yourself and that would be so awful. We want to see you healthy and in good spirits inspiring us with the beautiful work you are doing. Regards :)
It's hilarious to think in Monsters Inc. they had the same type of emergency response over a sock you would expect for a major building fire. All that over a sock!
log10(n!)=log(n!)/log(10) ~ (nlogn-n+log(2pin)/2)/log(10) is precise with error at most (12n)^-1/log(10). With an extra (12n+1)^-1/log10, it is precise with error at most (12n)^-2/log10.
I think I came up with an easier solution for the part where you determine the digit, correct me if I'm wrong. Knowing that we only have to look at the last digit of all numbers from 1 to 1000, we can multiply those and look at the last digit that is not a 0. Noticing that we get one 100 times, two 100 times, three 100 times and so on, we can raise each number to the 100th power and look what their last digit is (ignoring the zeros we get from the multiples of 10 because they only adds zeros at the end and we already know we can ignore them). Then you only need to multiply those last digits which gives us 40,320. Ignoring the zero at the end again we get 2 as the digit we were looking for But be warned I calculated that in my head, not with a calculator
I don't see how this makes any sense. You don't get to 100 times or any other number 100 times in 1000 factorial so cpuld.you clarify what youmean? Unless you mean like I reasoned there are 10 numbers nesing in 3 between 1 and one hundred and between 1 and 200 so 10 times 10 equals 100 so you have 100 terms for ending in each digit 0 through 9 between 1 and 1000..is that what you meant??
Saw the title (How to find the 2319th digit of 1000!)and my first reaction was "Huh, he's really excited, but the digit is 0, because it's 1000.00000.......0"
I posted a comment but the YT censors blocked it because it contained a link. Never mind that it was a relevant link. YT's AI isn't so smart after all. Or is the fault in YT's policies?
That flip was amazing!
And I had always thought that Michael was so serious! How wrong I was! 🐬 😂
Not expecting tgat
Doing math in his bare feet, living the dream
Omg he did it again
got an ad mid flip
6:57 and 12:51 Backflips
23:54 Good Place To Stop
i didn't know michael penn could skidoo
Omg the backflips are back!
wtf!
Yeah, I stopped around the 13 minute mark when the 2319th place is “special” and not some randomly chosen place
This looks so funny, I kept rewinding (hit key J) and rewatching a dozen tines, and I was LMFAO watching it. I'm still giggling a bit.
6:58 and that's a good place to backflip
Nice explanation. Small comment: At 22:40 to solve the congruence you can simply divide both sides by 2 because 4 is divisible by 2 :). You really only need to use the multiplicative inverse to solve a congruence when the right side is not a multiple of the coefficient on the left. Alternatively, for small numbers, you can find a congruent number that is a multiple of the coefficient. For example, to solve 3x=7 (mod 13), you can use that 7 is congruent to 33 (=7+2*13) modulo 13, so the solution is 33/3=11 (mod 13).
To comment on the "sketchy part" where we approximate log_10(1000!) using Stirling's approximation, the wikipedia page for Stirling's approximation gives explicit bounds, which could be used. In the introductory section one such bound is already given: for any integer n >= 1, n! = c sqrt(2pi n) (n/e)^n for some c between e^{1/(12n+1)) and e^(1/12n). Taking logs on both sides, we observe that ln(n!) is ln(sqrt(2pi n) (n/e)^n) + r, where r is going to be between 1/(12n+1) and 1/12n. For large n this error r is going to be very small and hence as long as the fractional part of the actual approximation is not too large (less than 1 - 1/12n) flooring the result gives you the correct integer. (For simplicity I worked with ln instead of log_10, doing it log_10 in fact gives an even better range)
Indeed, as long as log_10 of Stirling is not *too* close to an integer, we're in good shape. One might however wonder how bad approximations like pi² ~ 10 or e^3~20 are
But that's CHEATING right because if you don't know Stirling you cannot deduce it so there's no way to solve this problem right? I can't see any..o ly how to solve how many zeroes and that the last digit before the zeroes will be an even number so 2, 4 ,6 or 8
As a former physicist, it warms my heart to see Stirling’s Approximation in use.
I barely recognised it! In statistical mechanics, _log(n!) = n log(n) - n_ was always good enough, no need to get constants involved. I guess the difference is working with _n_ being about 10^20 rather than 10^3.
I know someone who called himself TypoKnig well over a decade ago. He was a big Grateful Dead fan and an extremely sharp wit. I think he'd be a little upset that a physicist is using his name while typing sentences containing no typos at all.
@@thefunpolice You don't know how many edits I had to make!
@@TypoKnig You're not fooling anyone!
Why former? What happened to you?
After watching many videos on this channel, the flip shocked me. I hope you do this in class 😂
Very impressive . Not only understanding how to approach the problem but also the persistence to see it through to the end
First, the "fact" counting the number of digits needs to be updated to 1+floor(log10(N)). Second, the digit sketchiness is quickly removed by using the improved version of Robbins (see Wikipedia entry on Stirling's approximation): s(n) * exp(1/(12*n+1) < n! < s(n) * exp(1/(12*n)), where s(n) is the Stirling formula. Under log10 for n=1000 this becomes a tiny additive interval that does not change the estimated number of digits.
I'm trying to find a reason that would have me want to know that - and I can't.
I was very confused from the video title at first, thinking we were finding the 2319th digit of 1000... This problem is much more interesting.
Same here.
But honestly - I think it works. It's much more attention-grabbing than the real title. 🙂
I originally thought the digits were counted in reverse order and now I am somewhat disappointed...
Lol yeaa, ig you have to add the 3 nd 1 to get 249 💀
The flip is back!!!!
The backflip is back!🎉
Thank you, professor!
Why doesn't he get chalk on his clothes using one side of his body to wipe the board each time?
Every video here is absolutely gorgeous
11:43 There is actually a little problem here that lies in substitution cbrooot(20) instead of e.
Just because log2(e) is multiplied by 1000 this approximation is not well enough. So the overall result in this approach will be a bit different (2569 instead of 2568)
You can also skip the mod 5 transformation at the end, note that 2^n mod 10 is a repeating sequence (2, 4, 8, 6, 2, 4, 8, 6, ...) which leads to the same reduction of 2^248 but still modulo 10. Then you have 2a=4 (mod 10), with two candidate solutions, a=2 and a=7
Python code
def fac(n):
res = 1
for i in range(1, n+1):
res *= i
return res
print(str(fac(1000))[2319-1])
or simply: str(math.factorial(1000))[2318]
Ran it, got 2 quicker than 1 second?
But Wolfram Alpha is even easier:
2319 digit of 1000!
returns 2
then you can get last digit of:
last digit of 1000!/5^249
returns 4 🤣
Love the backflip board change
I'd like to see you do a piece on spinor but when you flip, instead of clearing the board it takes all the spinor respresentations and introduces a factor of -1.
Here an alternative solution for the second part, based on the fact that for finding a trailing decimal digit we only have to look at the trailing digits of the factors: after removing all 249 "10"s, we have 997 - 249 = 745 remaining "2"s. And the power table for 2 mod 10 tells us that 2^745 has a trailing digit of "2", since 2^(1+4n) always ends with "2". And this 2^745 gets multiplied by some odd number not divisible by 5, so we now have to find the trailing digit of this odd number. To find it, we only have to count the number of all factors that end with "3", "7" and "9" resp.. We can omit "1" because it doesn't change anything. And there are exactly 100 factors in 1000! that end with "3", 100 factors that end with "7" and 100 factors that end with "9". The power table for 3 mod 10 tells us that 3^100 ends with "1" - since 3^(4n) always ends with "1" -, the power table of 7 tells us that 7^100 ends with "1" and the power table of 9 tells us that 9^100 also ends with "1". And there we have the solution, the digit we are looking for must be congruent 2 * 1 * 1 * 1 mod 10, i.e. it must be "2".
I think you are forgetting numbers that comes from factoring 2 and 5 out, like 6 -> 2*3 and 15 -> 5*3, those would contribute to the last digit after factoring 2 and 5 out
@kanashisa0 Damned, your are right! Thanks for pointing that out.
@@59de44955ebddoesn't it still work ans what do tou mean by power tables..ive never heard of that..whete did tou learn that..because after you factor put all the 2s you are left with terms ending in odd numbers so isn't your method correct?
I love these number theory problems thanks Professor
love these videos - very glad to see the return of the board-erasing back flip !
I thought you count digits from the right?
i think you count from the left because the “last digit” would be the ones place.
*π ≈ √10,*
*2 ≈ ¹⁰√1000,*
*e ≈ ³√20,*
*and that is a good place to stop.*
5:32 I wonder if there's a closed form for that infinite sum.
For p = 5 we have 249 = 1000 / (5 - 1) - 1
For p = 2 we have 994 = 1000 / (2 - 1) - 6
Actually Mathematica on my puny laptop takes 14 microseconds to calculate 1000!
do we have another version that not use the stirling's approximation?
2:19, well of course you've got the floor, it's your video 😛
Clever grouping at the end there. My immediate thought was to find the prime factorization of 1000!, which uses the same floor(n/p)+floor(n/p^2)+..., but that needs doing work on all the primes up to 1000, so I'd need a computer to get the answer from that point. And if I'm using a computer, I can already cheat and just like you said, just calculate 1000!.
I read the title but the with the "!" as an exclamation sign: "amazing! we are going to show you the 2319th digit of a 4 digit natural number: 1000" and I was like 🤔🤔 "1000.000.... and the 2319th is ZERO"
This is maths. We don't do amazing things in maths.
I'd never heard of Sterling's formula, but I'm proud of myself for getting floor(1000!/p^k) just having seen the thumbnail. I got it from the other side, considering powers of 2 first.
I'd considered finding the length of 1000! by summing log(1000) + log(999) + ... + log(1) using a computer, since I couldn't think of a way to group the factors.
You could try to estimate this sum by noting that it should be relatively close to the integral of log(x) from 1 to 1001. This integral unfortunately is equal to 2568.70, so after adding the 1 from the 1 + log(N)-formula and rounding down (we know we are overestimating), we get that it has roughly 2569 digits, one off the actual digit count.
We could also actually note that the integral of log(x) from 1 to 1000 would slightly underestimate the sum log(2) + log(3) + ... + log(1000), which is the same as the sum we're looking for (as log(1) = 0 anyway), but this integral is equal to 2565.70, so after adding the 1 from the 1+log(N)-formula and rounding up, we get that it has roughly 2567 digits, again one off the actual digit count.
This would tell us that the actual digit count would have to be 2567, 2568, or 2569.
We could now check that the difference between the sum log(1)+log(2)+log(3)+log(4)+log(5) and the integral of log(x) from 1 to 5 is greater than 0.3, so the error we do must be larger than 0.3 and the sum should therefore be larger than 2566, and therefore eliminate 2567 as an option. To eliminate 2569 in the same way, we'd have to unfortunately find the difference between the sum of the first 21 terms and the integral from 1 to 22, so this would be harder to eliminate in this way.
I have a spelling question: Sterling or Stirling? What is correct?
Stirling with an i for both factorial and thermodynamics
@@FadkinsDiet, thank you
You probably know this but there are more accurate versions of Sterling's formula. I have seen it as an infinite series so if you take more terms you will get higher precision.
There is a correction term to Stirling’s formula, so you can know whether it is far enough off to change the number of digits.
I still can't get over the backflip edit. Perfection.
Python can do this
C# also , C# needs to save source file but compiler and virtual machine which interprets CIL code has been already installed in Windows
and you dont need to install extra software
I never would have thought of that. Nor would I have thought of doing a backflip. So, an interesting video indeed. thanks!
Not only mental gymnastics, but physical too!
Can’t wait for this to be an olympiad warmup in 296 years
nice backflip transition
I like that you're using chalk and a blackboard instead of a whiteboard. That gives you credibility.
7:41:
2319 is indeed special. It’s the code for human contamination in Monsters: Inc.
i was wondering why no one was making that joke
It's an act of faith, or at least an act in hope, that the target digit is the last that's not a zero.
Had the target been to the right, then the solution would be zero, with less work.
But had the target been MANY DIGITS to the left of the last non-zero digit, I'm not sure that we'd be much closer to the goal.
(words in caps added for clarity)
This is number theory, the land of shortcuts, I'm sure there's some way to find any digit with relatively little computational effort
@@soupisfornoobs4081no.
In that case, we do Part II of the analysis in "modulo 100" instead of "modulo 10".
(This answer of mine is under the presumption that "to the left" means "directly to the left (of the last non-zero digit)" , rather than "in some specific position to the left (of the last non-zero digit)".)
@@yurenchu you've completely missed my point.
When you start work on the question, you don't know where the last non zero digit is
So you don't know if you'll land on the zeroes, or on the magic digit, not on the digit you are thinking of ...
Yeah, and thenif it turns out that it's seven to the left of the last one we can do the analysis using mod 100,000,000. Hardly a short cut.
By assuming "immediately to the left" you are still setting out as an act of faith/hope. And my point is that it's an *unjustified* assumption, and you are merely hoping that it will lead (after an initial investment of several lines of working) to a viable short cut.
In some situations you might be justified in assuming that the examiner is being kind to you: that's an act of faith, not of mathematics. Or you might simply be hoping.
Suppose you don't get lucky: suppose it's the digit where you have to take mod 10,000,000 or suchlike?
@@trueriver1950 The thing about math is, you have to be willing to test out the all kinds of lengthy analysis to go anywhere meaningful and unexplored. Which is why many math profesors encorage and appreciate work that is done 'tediously' or 'brute force', (even more than clever solutions), to reinforce the sentiment in the heads of their students.
If you dont get lucky, you try something else. AND dont get hung over thinking that your hypothesis might be wrong and the work you put in could be in vain. Many a times the work you put in will help you determine the correct the path or state for tackling the problem.
Subliminal backflips... Sith or Jedi ?
I tried and failed to solve this problem when I was an undergrad, I never knew that floor formula. It's sort of obviously right, from your explanation, and the right tool for the job, too.
That backflip caught me off guard
At first I was like "it's obviously 0, this must be an April Fool's thing", then I remembered that factorial notation exists.
Of course you had a 1 in 10 chance of guessing the right answer from the start... 😂
Only having seen the title my guess would be the 2319th digit could be one of the many zeroes already?
There have to be a bit more than 250 zeroes at the end (because every multiple of five ends up giving us one of the zeroes)
So if 1000! is about 2500 digits long the 2319th could still be one of those trailing zeroes.
Alright having seen the video
1. "a bit more than 250 zeroes" was too careless, I added the 200 fives + 40 twentyfives and reasoned there would be a few more
2. Unexpected backflip!
3. Your focus on the even digit in the middle makes me think that's gonna be our target number :O
4. 2568 - 2319 == 249 :D I guess that means I was wrong
5. Expected backflip!
That was some cool math, especially to find that last digit, even if my "easy"(/guesswork) solution was wrong once again :P
I got a question, which is probably stupid but from a simple observation, we can see, that in the denominator, we took 5 instead of 10, which is factor 1/2 of the original base 10. We easily compute 4. Now, we determine the real modulo (that is: the searched digit), can't we just use the factor 1/2 to compute the real modulo 4*1/2 = 2? Or is that that just a coincidence here? I don't know why, but this is the first maths video, I actually watched through till the end. I'll leave it as a compliment here for a good video! :D
Surf Arrakis. Fantastic.
I love the backflips
Will this work? I got 0.
Count the number of 0s at the end of 1000! This can be done by counting the number of 5s in 1000!, since every power of 5 contributes a 0 to the end of the factorial.
We can use the following formula to count the number of 5s in 1000!:
floor(1000 / 5) + floor(1000 / 25) + floor(1000 / 125) + floor(1000 / 625)
This gives us a value of 200 + 40 + 8 + 1 = 249.
Divide 2319 by 249. This gives us a quotient of 9 and a remainder of 147.
The remainder of 147 tells us that the 2319th digit of 1000! is the 148th digit of the number 10000...00147 (where there are 200 0s after the 1). The 148th digit of this number is 0, so the 2319th digit of 1000! is also 0.
8:00 should the log_10(N) be inside a floor function?
Yes
It should
Should be just a ceiling function of log(N) (without plus 1).
@@wesleydeng71 of course, even better!
@@wesleydeng71 But then the formula doesn't hold when log(N) is an integer, i.e, N a power of 10.
the real question should have been WHY, not How ? :D
nice. Only problem is the accuracy of Sterling.
Dear Prof Penn, I am a fan from Lahore. It is good to know that you are in great health and can flip so effortlessly. However, please do it rarely and only in a few videos with proper protection. I feel anxious and nervous that if you do it too often as you might hurt yourself and that would be so awful. We want to see you healthy and in good spirits inspiring us with the beautiful work you are doing. Regards :)
Those backflips were absolutely fundamental to validate the proof... :)
Well, nicely done!! Such a clever solution
Is this the actual source of 2319 in the Monsters Inc movie? Not the widely believed white sock?
It's hilarious to think in Monsters Inc. they had the same type of emergency response over a sock you would expect for a major building fire. All that over a sock!
log10(n!)=log(n!)/log(10) ~ (nlogn-n+log(2pin)/2)/log(10) is precise with error at most (12n)^-1/log(10). With an extra (12n+1)^-1/log10, it is precise with error at most (12n)^-2/log10.
Rxtxxxgr😊
R reexamine twee 3 f ex eeessutom r😬😭😬🤣🤣🤣😬😅🤣😅🇦🇴😅😅Derfex freed 14:25
Jag rfr4fdf ffa 😅rqx, x
Never seen the approximation sqrt(10) for pi
I think I came up with an easier solution for the part where you determine the digit, correct me if I'm wrong.
Knowing that we only have to look at the last digit of all numbers from 1 to 1000, we can multiply those and look at the last digit that is not a 0. Noticing that we get one 100 times, two 100 times, three 100 times and so on, we can raise each number to the 100th power and look what their last digit is (ignoring the zeros we get from the multiples of 10 because they only adds zeros at the end and we already know we can ignore them). Then you only need to multiply those last digits which gives us 40,320. Ignoring the zero at the end again we get 2 as the digit we were looking for
But be warned I calculated that in my head, not with a calculator
I don't see how this makes any sense. You don't get to 100 times or any other number 100 times in 1000 factorial so cpuld.you clarify what youmean? Unless you mean like I reasoned there are 10 numbers nesing in 3 between 1 and one hundred and between 1 and 200 so 10 times 10 equals 100 so you have 100 terms for ending in each digit 0 through 9 between 1 and 1000..is that what you meant??
Wait where exactly did you get 40,320 from?
Going head over heels for these.
lmao I thought the exclamation mark at the end was just because he was excited...which then made me very confused.
very interesting!! An important application of Stirling formula...
could be nice to precise that actually the first formula is called " Legendre's formula"
Some people would count the digits from the LSD (least significant digit) which would make "what is the 250th digit" faster to solve...
Can we do a series of projecteuler problems?
The backflip startled me 😝
I’m going to go out on a limb and guess 0 before any math work
instant like after that backflip
Saw the title (How to find the 2319th digit of 1000!)and my first reaction was "Huh, he's really excited, but the digit is 0, because it's 1000.00000.......0"
came for arithmetics stayed for the backflips
Michael. Was that your first backflip on the channel? Thanks for all your wonderful posts.
Nope, he used to do backflips all the time in the past. Then he stopped for some reason.
Impressive. The maths and the flip
I thought for several moments that the exclamation mark in the title was punctuation, and so the 2319th digit of 1000 was zero.
It's been a while since I've seen a backflip transition on here! Nicely done!
I posted a comment but the YT censors blocked it because it contained a link. Never mind that it was a relevant link. YT's AI isn't so smart after all. Or is the fault in YT's policies?
Briefly forgot about the exclamation point use for factorial so I though you were just really exited to show us the 2319th digit of 1000
"2319! We have a 2319!"
Dude! What's with the flip? :) Awesome problem and awesome solution btw...
Great video !
i laughed and instantly liked the video after the flip. so glad to see it back!
Best transitions ever !
Interesting problem and good video. Btw what chalk is that?
best way to erase a chalkboard
You did not really the flips, did you?
i can't believe the backflips are back!
Wait did he just do a backflip?😂
Yooooooooo great solution development
I could tell you the last digit, the second to last, third to last... It only took me 0.2 seconds
They're back! (flips)
Now find the 2050th digit of pi. 💀
I can find you the 50 trillionth digit of pi
It's between 0 and 9
(inclusive)
@@soupisfornoobs4081what is it?
My head hurts
That's a good place for a backflip!
I don't believe you can do backflips Mike at your age!!! So this is more than likely prestidigitation through some great computer generation!!!
My first impression of the thumbnail and its title in Google's right sidebar was...
This! is! clickbait!
The human mind can handle numbers bigger than the particles in the known universe....at least when I'm watching your videos 🤣
Now do the 2317th digit