I have reached that: 4M = N - N * (1/5) ^ floor(log_5(N)) using the geometric sequence and I don't know how should I continue from here and not sure if I am right
حضرتك فى الجزئيه دى قولت اننا عاوزين اكبر اوس لل p بحيث يكون n تقبل عليه بعدين قولت 1*p, 2*p, 3*p... يعنى حسبت القيمه اللى اضربها فى p مش الاس زى ماكنت كاتب فوق ولا انا فهمت غلط ولا ايه ؟؟ ودى التوقيت بتاع الجزئيه دى فى الفيديو توفيرا للوقت : ua-cam.com/video/YTLv1fgISPI/v-deo.htmlm59s // Given a prime p, and n!, what is max x such that n! divisble by p^x // For each multiple M of p
ربنا يكرمك على المجهود الرائع.. أنا بقالي فترة طويلة بدور على حاجة قوية بالشكل ده عشان أبدأ في الـalgorithms سؤال.. المسألة 1375، حاسس إن مالهاش علاقة بالـfactorials، أعتقد إنك كنت تقصد 10375؟؟
Using the fact that the factorization of a factorial of a number always has more 2s than 5s so i only care about 5s, and i need exactly M fives to get M trailing zeros so i simply take N = M*5, And yes i've tried my solution on some small test cases and it worked.
@@ArabicCompetitiveProgramming i can't get your piont sir .. you said "trailing zeros" and 15! has three trailing zeros and its the smallest factorial that has three "trailing zeros", which satisfies my solution N = 3*5 = 15
I have reached that:
4M = N - N * (1/5) ^ floor(log_5(N))
using the geometric sequence and I don't know how should I continue from here and not sure if I am right
ربنا يجازيك خير ع المجهود ويجعله في ميزان حسناتك
حضرتك فى الجزئيه دى قولت اننا عاوزين اكبر اوس لل p بحيث يكون n تقبل عليه بعدين قولت 1*p, 2*p, 3*p...
يعنى حسبت القيمه اللى اضربها فى p مش الاس زى ماكنت كاتب فوق ولا انا فهمت غلط ولا ايه ؟؟
ودى التوقيت بتاع الجزئيه دى فى الفيديو توفيرا للوقت : ua-cam.com/video/YTLv1fgISPI/v-deo.htmlm59s
// Given a prime p, and n!, what is max x such that n! divisble by p^x
// For each multiple M of p
Seems this O(n/p) code is wrong. It should be O(!n/p)
ideone.com/bhXiQb
JWA. Yes, thanks for correction
ربنا يكرمك على المجهود الرائع.. أنا بقالي فترة طويلة بدور على حاجة قوية بالشكل ده عشان أبدأ في الـalgorithms
سؤال.. المسألة 1375، حاسس إن مالهاش علاقة بالـfactorials، أعتقد إنك كنت تقصد 10375؟؟
ربنا يكرمك وان شاء الله تستمر اكتر وتفيدنا اكتر
Is the answer of the last question N = M * 5 ?
tried to simulate some using ur code and see?
tried to prove?
Using the fact that the factorization of a factorial of a number always has more 2s than 5s so i only care about 5s, and i need exactly M fives to get M trailing zeros so i simply take N = M*5,
And yes i've tried my solution on some small test cases and it worked.
@@mahmoudrifaat5325 but N! already has some zeros inside it?
According to, If I want the M=3 zeros, then N=15, have u checked what is !15 ?
@@ArabicCompetitiveProgramming i can't get your piont sir .. you said "trailing zeros" and 15! has three trailing zeros and its the smallest factorial that has three "trailing zeros", which satisfies my solution N = 3*5 = 15
@@mahmoudrifaat5325 what is the value of 15!?
why we will use only a-b 2's ?
which second? I forgot such old video :D
Answer of last question is
5*M