Do you have an idea of the running time for 10^6?That's for 10000!
I will try later for 10^6.
Do you have an idea of the running time for 10^6?That's for 10000!
I will try later for 10^6.
if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!Sir a lot of tail zeros in factorial numbers. Is there a known function to know how many tail zeros for a given n! without calculating n!
nice! good to know when counting large factorial sums, dont want to loose out on a zero!if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!Sir a lot of tail zeros in factorial numbers. Is there a known function to know how many tail zeros for a given n! without calculating n!
if n is divisible by [$]5^m[$] then n! has m more zeros than (n-1)!
it'll be something like
int(n/5)+int(n/[$]5^2[$])+int(n/[$]5^3[$])+....
where int(x) is the largest integer that is smaller than x, eg int(3.8)=3
I think it's a good ploy.if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!Sir a lot of tail zeros in factorial numbers. Is there a known function to know how many tail zeros for a given n! without calculating n!
if n is divisible by [$]5^m[$] then n! has m more zeros than (n-1)!
it'll be something like
int(n/5)+int(n/[$]5^2[$])+int(n/[$]5^3[$])+....
where int(x) is the largest integer that is smaller than x, eg int(3.8)=3
Hmmm.. There's something wrong with your factorial, then because x000...000 * y will always have the same number of zeros unless x ends in 5 and y is even or x is even and y is divisible by 5. In the case of factorial, x is always even because there are more factors divisible by 2 than by 5 so that every factor divisible by some number of 5's creates a new product with that many 5's worth of 0's.nice! good to know when counting large factorial sums, dont want to loose out on a zero!if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!Sir a lot of tail zeros in factorial numbers. Is there a known function to know how many tail zeros for a given n! without calculating n!
if n is divisible by [$]5^m[$] then n! has m more zeros than (n-1)!
it'll be something like
int(n/5)+int(n/[$]5^2[$])+int(n/[$]5^3[$])+....
where int(x) is the largest integer that is smaller than x, eg int(3.8)=3
but is this correct?: "if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!"
Fact(n=33) has 22 tail zeros. 33 not divisible by 5, and Fact(n=33) has more tail zeros than Fact(n-1=32) 21 tail zeros
Use your prime staff? (A primstav (translation: prime staff) is the ancient Norwegian calendar stick. )I think it's a good ploy.if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!Sir a lot of tail zeros in factorial numbers. Is there a known function to know how many tail zeros for a given n! without calculating n!
if n is divisible by [$]5^m[$] then n! has m more zeros than (n-1)!
it'll be something like
int(n/5)+int(n/[$]5^2[$])+int(n/[$]5^3[$])+....
where int(x) is the largest integer that is smaller than x, eg int(3.8)=3
https://www.geeksforgeeks.org/count-tra ... al-number/
An interesting related topic is to compute the prime factors of n!.
I have some C++ code for this; will have a look to see if it works for them C# Biginteger beasts.
yes it was Excel :are we at cross purposes?
from maple,
33!=8683317618811886495518194401280000000
which has 7 trailing zeros
and int(33/5)+int(33/5^2)+int(33/5^3)+.....=6+1+0+0+0+.....=7
32!=263130836933693530167218012160000000
which also has 7 trailing zeros
you must use \ ( \ )oops, no latex formulas working?
Use your prime staff? (A primstav (translation: prime staff) is the ancient Norwegian calendar stick. )I think it's a good ploy.
if n is not divisible by 5, then n! has the same number of tail zeros as (n-1)!
if n is divisible by [$]5^m[$] then n! has m more zeros than (n-1)!
it'll be something like
int(n/5)+int(n/[$]5^2[$])+int(n/[$]5^3[$])+....
where int(x) is the largest integer that is smaller than x, eg int(3.8)=3
https://www.geeksforgeeks.org/count-tra ... al-number/
An interesting related topic is to compute the prime factors of n!.
I have some C++ code for this; will have a look to see if it works for them C# Biginteger beasts.