How to find the first 2 nonzero terms in Mod100 of n! without a prefix?

  • Thread starter Thread starter heartyface
  • Start date Start date
AI Thread Summary
To find the first two nonzero terms of n! modulo 100, one must first determine the number of trailing zeros by counting factors of 5, as they limit the number of nonzero digits. After identifying the trailing zeros, remove equal factors of 2 and 5 from the factorial's prime factorization. The remaining factors can then be multiplied together modulo 100 to avoid large numbers. This method is efficient for smaller values of n, but becomes complex for larger n, often requiring advanced number theory techniques. Understanding these principles is essential for solving related problems in cryptography and combinatorics.
heartyface
Messages
28
Reaction score
0
hello
so I know how to get the 0s in n!, but how do I find the first 2 nonzero terms?
Is there a shortcut?
thanks :)
 
Mathematics news on Phys.org
do you mean the 2 right-most non-zero digits?

if so, that is not mod 100, unless you only have 2 "trailing 0's".

it WILL be mod 10k for some k, but n! grows very quickly, and so unless n is between 10 and 14 (inclusive), k is not 2.
 
hehe... that's why I said '2' first *nonzero* terms to n!
 
heartyface said:
hehe... that's why I said '2' first *nonzero* terms to n!

i understood what i thought you meant. but, realize the convention in english, is to parse left-to-right, so the first 2 digits of 5687 are 5 and 6, not 7 and 8.

i don't think there is a general formula for all n, usually, finding the right-most non-zero digits of n! requires a fair amount of work (finding the number of 0's at the end is not so bad, you can count occurences of factors of 5 (since we get 5 even numbers for every 2 multiples of 5, the factors of 5 will be the limiting factor, here)).

do you have a specific n! in mind?
 
<random number generator> hmm, let's go with 109!
and yeah my english sux :P also, that's interesting! hmm, so if I actually did mean the 'first' 2 digits of n!, that seems... way more work(?!) hehe, let me try that out
 
To find the last 2 non-zero digits before all the zeros at the end.

factor n!, which is easy, because it has [n/p] + [n/p^2] + [n/p^3] + ... factors of p.

(where [x] is the largest integer, smaller or equal to x)

remove all factors of 5, and an equal number of factors of 2, now multiply what is left together modulo 100, so you never have to multiply numbers with more than 2 digits.
 
willem2 said:
To find the last 2 non-zero digits before all the zeros at the end.

factor n!, which is easy, because it has [n/p] + [n/p^2] + [n/p^3] + ... factors of p.

(where [x] is the largest integer, smaller or equal to x)

remove all factors of 5, and an equal number of factors of 2,
.

yuh... i knew that:)
willem2 said:
now multiply what is left together modulo 100, so you never have to multiply numbers with more than 2 digits
it's easy to say that.. but how do you 'multiply the numbers' when there are some 100s of them.. then simply modulo100 it :(
 
heartyface said:
yuh... i knew that:)
it's easy to say that.. but how do you 'multiply the numbers' when there are some 100s of them.. then simply modulo100 it :(

There are quite a lot of results in number theory that help you do these kinds of problems and also problems that are useful for doing this for really really large numbers (this kind of thing is common in cryptographic applications).
 
ummm so like from this problem http://www.artofproblemsolving.com/Wiki/index.php/2010_AMC_10A_Problems/Problem_24
I don't understand it from the M=(1*2*3*4)(6*7*8*9)...*(86*87*88*89)......blabla
yup :( enlightenments?
 
Last edited by a moderator:
  • #10
oaKka.png
 
Back
Top