Number of digits of n!

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 127

  • @ju5039
    @ju5039 8 месяцев назад +30

    Your talent to explain complex matters in a clear and direct manner is simply unmatched. Thank you for making these lectures.

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs 26 дней назад +1

    I enjoy you explaining these problems to everyone listening.

  • @kenhaley4
    @kenhaley4 2 месяца назад +6

    I wrote a python program to check your final formula. Sadly it fails for the following values of n in the range 1 to 1000:
    96, 97, 98, 99, 100, 101, 102, 103, 122, 139, 190, 233, 241, 261, 331, 380, 415, 431, 445, 497, 583, 596, 624, 629, 634, 655, 716, 723, 789, 799, 821, 833, 861, 897, 921, 958, 959
    In all these cases, your formula calculates one MORE than the actual number of digits in n! I'm guessing these are all edge cases having to do with the Riemann sum approximation.
    Nevertheless, your videos are fantastic, and your presentation method is captivating. Keep up the good work...I love watching you.

  • @surendrakverma555
    @surendrakverma555 8 месяцев назад +11

    Very good lecture Sir. Thanks 👍

  • @Jon60987
    @Jon60987 8 месяцев назад +7

    This is an awesome video. A nice follow up would be to take the left, right, and midpoint equations for number of digits, and then display some charts to show how accurate or how inaccurate each of the 3 equations are. As you were clear about, these are all approximations and not exact values. However, one of the other posts which gives a few values shows that you came up with some very nice approximations to the actual values. I found this to be a very impressive demonstration of using Riemann Sums in a way that I would not have come up with on my own.

  • @Misteribel
    @Misteribel 7 месяцев назад +2

    6:30 you probably want to use the floor function and then add one. Otherwise, it won't work with numbers like 10, 10000 etc. For this exercise, though, the result is the same as we won't get an exact power of 10.

  • @guyneljean-francois4150
    @guyneljean-francois4150 8 месяцев назад +3

    For the factorial of the small numbers, you could also rewrite the number as a product of primes (but for the huge numbers like 1000!, it would be boring). For example 5! = 5*4*3*2*1 = 5*3*2^3*1. log(5!)= log(5) +log(3)+3log(2) +log(1) = 2.079
    and ceil(2.079) = 3
    However for the numbers in the form of 10^n, the number of digits seems rather to be (1+n) instead of (log10^n).

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs Месяц назад +1

    Your gifted!

  • @JesseBusman1996
    @JesseBusman1996 8 месяцев назад +40

    The ceil of log10 doesn't work to get the amount of digits of numbers like 10^n; for example ceil(log10(1000)) gives 3 digits which is wrong
    So I think it should be 1+floor(log10(n))

    • @PrimeNewtons
      @PrimeNewtons  8 месяцев назад +28

      You're correct. I was blind sided by the fact that no factorial is 10^n.

    • @sanskarvirat2844
      @sanskarvirat2844 8 месяцев назад

      ​@@PrimeNewtonsI laughed for quite a while. Good videos

    • @allozovsky
      @allozovsky 8 месяцев назад +3

      @@PrimeNewtons > no factorial is 10^n
      Objection! 9.4456089! = 10⁶ - we already know how to evaluate non-integer factorials. No *integer* factorial is 10ⁿ.
      *NB* this is supposed to be a joke, so that nobody in the comments gets confused.

    • @iqtrainer
      @iqtrainer 8 месяцев назад

      @@allozovskyYeah you are just negative and meaninglessly objecting everything. You def seem to be ill

    • @iqtrainer
      @iqtrainer 8 месяцев назад

      @@allozovskyYeah you are objecting again. Blah blah blah

  • @temporarytemporary-fh2df
    @temporarytemporary-fh2df 7 месяцев назад +1

    Stirling formula calculates the exact number of digits and the exact frontmost digits it is super useful.

  • @allozovsky
    @allozovsky 7 месяцев назад +5

    But following the logic in the video, in order to "stick in the middle" we have to shift *both* limits of integration by one half, not just the upper one, so the final formula would be
    log₁₀(n!) ≈ [x·(ln(x)−1)/ln(10)] at [x₀; x₁] = [1.5; n+0.5]
    = [(n+0.5)·(ln(n+0.5)−1) − 1.5·(ln(1.5)−1)]/ln(10)
    ≈ [(n+0.5)·(ln(n+0.5)−1) + 0.8918]/ln(10)
    so the number of decimal digits of n! is
    log₁₀(n!) ≅ ⌊((n+0.5)·(ln(n+0.5)−1) + 0.8918)/ln(10)⌋ + 1
    This minor change significantly decreases the number of errors (by roughly 2.5 to 3 times), but nevertheless errors still occur (at a rate of about 1.3%, that is ≈13 cases out of every 1000), but that's probably the best we can do with this approach.

  • @guyneljean-francois4150
    @guyneljean-francois4150 8 месяцев назад +4

    Based upon my first comment, to be general, the number of digits of n is equal to (1+ floor(log(n) )

  • @FrostNapCat
    @FrostNapCat 2 месяца назад

    Never understand what the log() function does until now. Thank you very much

  • @רובימהאנדרואיד
    @רובימהאנדרואיד 8 месяцев назад +33

    Amazing. May I ask? As u mentioned 5 doesn't work. Why?

    • @liammoore1066
      @liammoore1066 8 месяцев назад +13

      I believe it is just to do with that the fact that the integral of the Riemann summation is an approximation. I’m guessing that because 5! is one of the first numbers to add another digit (120) and it only passes 100 by 20 it probably failed due to this. Lmk if anyone else has thoughts on this I may be wrong.

    • @allozovsky
      @allozovsky 8 месяцев назад +4

      Neither the original nor the "shifted by one half" formula works for all natural numbers. For example, 96! has 150 decimal digits, but the shifted formula yields 151. And there are as much as 37 such whole numbers among the first one thousand. So it's rather a miracle that it did work for 1000!

    • @justrandomthings8158
      @justrandomthings8158 8 месяцев назад +5

      963/1000 doesn’t sound very miraculous but what do I know

    • @allozovsky
      @allozovsky 8 месяцев назад +3

      @@justrandomthings8158 We missed the nearest "wrong" number by 41, so we aimed well.

    • @liammoore1066
      @liammoore1066 8 месяцев назад +1

      Does anyone know why he chose to shift by 1/2? I didn’t understand that since the integral is an infinite amount of rectangles. Was it just so 1000 would work

  • @adw1z
    @adw1z 8 месяцев назад +8

    Small point: in your summations, I believe the upper limit should be x and the dummy variable as n

    • @sammtanX
      @sammtanX 8 месяцев назад

      I thought about the same thing, but would it be different for the result of the integral?

    • @adw1z
      @adw1z 8 месяцев назад

      @@sammtanX yes same goes for the integral too, as we want it as a function of x like the LHS

  • @NormanicusDiabolicus
    @NormanicusDiabolicus 8 месяцев назад +2

    I really enjoy all your videos so clearly and lucidly explained. However, I cannot understand the logic used in this video. 1000! is clearly a product of 1000 discrete integer terms; yet you are employing an integration between two limits( n and 1) which is only valid for continuous functions. Using the gamma function is surely invalid for factorials of integers?

    • @PrimeNewtons
      @PrimeNewtons  8 месяцев назад

      I claimed I was using the shifted gamma function, which is continuous.

    • @NormanicusDiabolicus
      @NormanicusDiabolicus 8 месяцев назад +2

      @@PrimeNewtons Yes , but 1000! is the product of discrete integers , so why is using the continuous gamma function valid? It's like using Integration of x between 1 and 100 to determine the sum of all consecutive integers from 1 to 100 , instead of 100(100+1)/2

    • @NormanicusDiabolicus
      @NormanicusDiabolicus 8 месяцев назад

      My replies have been deleted!!

    • @allozovsky
      @allozovsky 8 месяцев назад

      @@NormanicusDiabolicus Rather shadow banned by youtube (esp. if you comment contained a lot of digits and/or math symbols).

    • @allozovsky
      @allozovsky 8 месяцев назад

      Normally you still can find all your shadow banned comments intact in the Comments section of you youtube History.

  • @Arkapravo
    @Arkapravo 8 месяцев назад +10

    Very nice, you could have used Stirling's approximation directly

    • @guyneljean-francois4150
      @guyneljean-francois4150 8 месяцев назад +4

      Sterling's approximation could give you an estimate of the factorial of the number but not the number of digits. Then, you'll need to count after and in the case of the huge numbers like 1000, the calculator won't be able to display the calculus.

    • @Arkapravo
      @Arkapravo 8 месяцев назад

      @@guyneljean-francois4150hmmmm.... n^n becomes the nonsense bit. I agree with you.

    • @allozovsky
      @allozovsky 8 месяцев назад +3

      But you can use the logarithm of the approximation instead:
      log(n!) ≈ (n·ln(n) − n + ln(2πn)/2)/ln(10)
      That would give much smaller values.
      This is almost our formula from the video, but with a better correction term.

    • @hejjakaroly5850
      @hejjakaroly5850 7 месяцев назад +2

      @@allozovsky Yes, this formula is far more accurate. I didn't find a single error up to n = 1 000 000.

    • @allozovsky
      @allozovsky 7 месяцев назад +1

      @@hejjakaroly5850 So for any practical purposes (as though there may be any practical purpose in determining the number if decimal digits in a factorial) we may safely use this approximation.

  • @liulmesfin-d5f
    @liulmesfin-d5f 8 месяцев назад

    This is amazing. Please don't stop these videos

  • @milindsarkar6961
    @milindsarkar6961 7 месяцев назад

    Great sir. ❤

  • @futuregenerationinstitute9613
    @futuregenerationinstitute9613 8 месяцев назад +2

    Could you please drop another one showing parallelogram properties using diagonals and their formulas in terms of perimeter, area, and the side lengths. Thank you.

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs 26 дней назад +1

    1000! Has 2568 digits in it.

  • @barryzeeberg3672
    @barryzeeberg3672 2 месяца назад

    Can you use Stirling approximation?

  • @sammtanX
    @sammtanX 8 месяцев назад +1

    the great thing is, if you put log_10(x!) = (x ln(x) - x + 1)/ln(10) in desmos, it will just show x = 1.

    • @allozovsky
      @allozovsky 8 месяцев назад

      Hm, makes perfect sense, though.

  • @johnka5407
    @johnka5407 8 месяцев назад +1

    The system with logarithms at the beginning doesn’t work for the powers of 10, ceiling(log(10)) is 1, but 10 has 2 digits. I think floor(log(x)) + 1 would be better.

  • @davidmexicotte9862
    @davidmexicotte9862 4 месяца назад

    You need to start a site and sell your hats! Great channel.

  • @antosandras
    @antosandras 2 месяца назад

    This is a proof for x=n. :) Also for an incorrect (approximate) formula for log (n!).

  • @nothingbutmathproofs7150
    @nothingbutmathproofs7150 8 месяцев назад +2

    Very nice. At the bottom of the 2nd board I wouldn't have put an equal sign.

  • @GURPARASSINGH-sg8sv
    @GURPARASSINGH-sg8sv 8 месяцев назад +4

    2:48
    Vsuace reference
    I gotchu😂😂

  • @KahlieNiven
    @KahlieNiven 7 месяцев назад

    The power of log (log, not love) will always amaze me.
    From quick calculations (from mind) I found number of digits between 1000 and 3000. (that not solves but helps to find coherent result).
    then formals.
    EDIT : 3 digits x 1000 +1 minus 100 >= 2901 > N > 2x900+something > 1800 (log_10 applied intuitively) ... 100x101..x999x1000 -> at least 2x900 digits.
    (I wasn't sure about the ways to write the log ... ln ? log_e ? log ? in france ln is log_e, log is log_10, log_a is obviously log_a.)

  • @insteresting
    @insteresting 11 дней назад

    Nice work, but the formula gives an estimation of what the number of digits is, not exactly the actual number, since it fails for some values of n (not only n = 5).

  • @ironfbody
    @ironfbody Месяц назад

    Could (should) have used Simpson's rule for the integral ?

  • @chaosredefined3834
    @chaosredefined3834 8 месяцев назад +1

    But we can get an indication of if it will fail. Take the case of 5!. As you point out, we want log(5!), which is log(1) + log(2) + log(3) + log(4) + log(5). And we can ignore the 1, so we get log(2) + ... + log(5). At this point, you replace it with an integral, which is an approximation. But if we go for the integral of 1-5, it's going to be smaller. If we go for the integral of 2-6, it's going to be larger. You resolve this at the end by taking the midpoint (1.5 - 5.5). But our underestimate is 1.7577... and our overestimate is 2.3297.... Which tells us that log(5!) is between 1.7577... and 2.3297..., so we don't know what value floor(log(5!)) or ceil(log(5!)) will take (the floor is either 1 or 2, the ceil is either 2 or 3). Compare this to log(4!), which is between 1.1054... and 1.5899..., so we know it's always 1.(something), so floor(log(4!)) = 1, and ceil(log(4!)) = 2.

    • @allozovsky
      @allozovsky 8 месяцев назад

      @chaosredefined3834 > You resolve this at the end by taking the midpoint (1.5 - 5.5).
      But seems like with our "shifted" formula we are integrating from 1 to n+0.5, not from 1.5. Though there are no obvious reasons why it should work for all n (and in fact it does not).

    • @chaosredefined3834
      @chaosredefined3834 8 месяцев назад +1

      @@allozovsky He should have gone from 1.5 to 5.5. That's an error on his part, but the error will be minor.

    • @allozovsky
      @allozovsky 8 месяцев назад

      The "error" is actually equal to the value of the integral from 1 to 1.5, that is approximately 0.0470 - whether it is small or not is hard to tell, since we still have no measure to estimate it's impact.

    • @chaosredefined3834
      @chaosredefined3834 8 месяцев назад

      @@allozovsky Assuming that the logs are evenly distributed (which we don't know, but it's a reasonable assumption), it's an error of 1 in approximately 4.7% of cases. Fortunately, the estimate of logs in the other part is an error in the other direction, so it "should" be ok.

    • @allozovsky
      @allozovsky 7 месяцев назад

      A shifted formula will not overcome Stirling's approximation anyway, since the latter has a term depending on n, which presumably should provide a better accuracy. The shifted model is too rough.

  • @gp-ht7ug
    @gp-ht7ug 8 месяцев назад

    If you say that x! is continuous function, why don’t you use the integral of the Π(x) function for the factorial?

  • @dirklutz2818
    @dirklutz2818 8 месяцев назад

    Fantastic lesson.

  • @temporarytemporary-fh2df
    @temporarytemporary-fh2df 7 месяцев назад

    By doing so you'r just rewritung the stirling approx which i do prefer than using it blindly.

  • @jetstream_samm
    @jetstream_samm 7 месяцев назад

    what would you say, if there at answer was 2567.5 for example ?

  • @lethalsub
    @lethalsub 8 месяцев назад

    Factorise 10, 2*5. 5 is the bigger factor. 1000//5=200, 1000//5**2=40, 1000//5**3=8, 1000//5**4=1, 200+40+8+1=249. 249 zeros at the end of 1000!.

  • @omarito8955
    @omarito8955 12 дней назад

    i understood your explanation but i am not sure about the ceilling fonction cuz imagine we get 9.1 for example, it conains 1 digit but if we take it s ceilling that will be 10 wich it has 2 digits. Maybe i just didn't understand i hope if someone could explain if i am wrong

  • @boguslawszostak1784
    @boguslawszostak1784 8 месяцев назад

    In the 13th minute, you placed an equal sign between the first expression at the top of the board and the result obtained, but in the second row, it is not an equality but an approximation.

  • @allozovsky
    @allozovsky 8 месяцев назад

    But neither the original nor the "shifted by one half" formula seems to work for all natural numbers. For example, 96! has 150 decimal digits, but the shifted formula yields 151. And there are as much as 37 such whole numbers among the first one thousand. So it's rather a miracle that it did work for 1000!

    • @PrimeNewtons
      @PrimeNewtons  8 месяцев назад +1

      Looks like there's another adjustment to be made.

    • @allozovsky
      @allozovsky 8 месяцев назад +1

      @@PrimeNewtons Stirling's approximation (when we replace the "+1" term in the original formula by ln(2πn)/2) gives much better results, which is understandable, since now our correction term depends on n, which gives a better approximation.

  • @AMANRAJ-dt8gu
    @AMANRAJ-dt8gu Месяц назад

    made my day. thank you

  • @vitotozzi1972
    @vitotozzi1972 8 месяцев назад

    Awesome!!!!

  • @alexdefoc6919
    @alexdefoc6919 7 месяцев назад

    Hey, now we need to know how to find the first 2 digits or 3 to put it in scientific notation of x.yz * 10^2568

  • @ubahprecious6151
    @ubahprecious6151 Месяц назад

    You are a boss

  • @amirrozenmanmalach3771
    @amirrozenmanmalach3771 8 месяцев назад

    Why do you write the times 1? Does it have some reason?

  • @robot8324
    @robot8324 8 месяцев назад

    Thank you !❤

  • @Dr_piFrog
    @Dr_piFrog 2 месяца назад

    I'll guess that there are 2568 digits in 1000!. Let me know if true or false.
    Your formula varies from one-off to spot-on values.

  • @yaronbracha4923
    @yaronbracha4923 8 месяцев назад

    I liked it !

  • @reekhilchawla3197
    @reekhilchawla3197 3 месяца назад

    awesome

  • @povijarrro
    @povijarrro 7 месяцев назад +2

    Nice 1000 seconds long video about 1000!

  • @SidneiMV
    @SidneiMV 8 месяцев назад

    Great!

  • @chivalioum
    @chivalioum 8 месяцев назад

    Awesome

  • @aminsheykh7057
    @aminsheykh7057 7 месяцев назад

    Your videos are amazing👍

  • @zdhshue
    @zdhshue 28 дней назад

    But why isn’t the sum ln(x-k) for sum from k =0 until n

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs 5 месяцев назад +2

    1000! Has 2,568 digits

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs 5 месяцев назад +1

    5!=120

  • @Muralimurali-o3n
    @Muralimurali-o3n 3 месяца назад

    Only ramanujan can understand this 🥵

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs 4 месяца назад +1

    1000! has 2,568 digits in it

  • @stevenshrii
    @stevenshrii 2 месяца назад

    Ln(-1)/sqrt(-1) = pi

  • @klementhajrullaj1222
    @klementhajrullaj1222 7 месяцев назад

    How many digits has 2^100?!

    • @cyberagua
      @cyberagua 7 месяцев назад +1

      But that's easy: floor[100×log(2)] + 1 = 31

  • @WhiteGandalfs
    @WhiteGandalfs 8 месяцев назад

    When taking the simple integral, we arrive at about 2566 digits. When asking Wolfram Alpha about the exact product, it spits out 2568 digits. So this method demonstrated here (giving 2568) is a pretty exact one. That little correction appendix is the usual way how engineers tend to tackle such things :D

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs Месяц назад +1

    I love math.

  • @wildfire_
    @wildfire_ 2 месяца назад

    4!

  • @cyrusrosales3127
    @cyrusrosales3127 8 месяцев назад

    smart

  • @lubiemuze6368
    @lubiemuze6368 8 месяцев назад

    Three😂

  • @Thampuran-o9o
    @Thampuran-o9o 15 дней назад

    👍👍👍👍

  • @RyanLewis-Johnson-wq6xs
    @RyanLewis-Johnson-wq6xs 26 дней назад

    How many digits are in 1000! There’s 2319 digits in it trailing 249 zeros at the end. 1000!=402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

  • @robot8324
    @robot8324 8 месяцев назад

    Thank you !❤