Compute the smallest positive integer N such that 1 2 1 2 N ! is an integer.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
How do you know it's 28 though?
Log in to reply
We need a number that has 12 3s and 24 2s in its prime factorization.
Every multiple of 3 adds one 3, every multiple of 9 adds an additional 3, and a multiple of 27 adds yet another 3. Thus 27! has 9+3+1=13 3s; 26! only has 10 3s. You can just count these 3s up on your fingers if you are being lazy as you count up from 1! to 27!.
Likewise every multiple of 2, 4, 8, 16 adds 1, 2, 3, and 4 2s to the prime factorization respectively. 27! however only has 13 2s, 6 4s, 3 8s, and one 16 - that's only 23 2s. 28 adds an extra 4 to give it 25 2s in the prime factorization.
Hi dev! I've got N=27 as the smallest integer which satisfy the condition of the problem. 27! = 1.08888694504184E+28, 12^12 = 8916100448256, 27!/(12^12) = 1221259171945310 Please correct me if I was wrong.
Log in to reply
My guess would be that you are hitting a rounding error.
Log in to reply
Yeah it could be 1-of the reasons. another thing which makes me curious about, how can we assure that this Bruce force will give us the smallest integer without seeing its all number digits (applicable for too large #s)?
Log in to reply
@Rene Dela Cerna – Two techniques spring to mind :
Use a calculator which does completely accurate Big Integers - some modern programming languages have libraries to do, and python does this automatically (and has a very cool interactive console which allows you to do calculations without writing code).
Some techniques like modular arithmetic allows us to work with larger numbers without loss of generality - but to be honest, I prefer technique 1 :-)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
More brute force from me - python 2
import math
a = 12**12
for i in range(1, 1000):
if math.factorial(i) % a == 0:
print i
break
28! has 14+7+3+1=25 factors of 2, and 9+3+1=13 factors of 3, which means it has more than enough 2s and 3s. 27! has 13+6+3+1=23 factors of 2, so it's not sufficient. Thus, 28 is the answer.
I used brute force method and got N=28 as 12^12=2^24*3^12
What is brute force method
Log in to reply
It means that you actually calculate the values rather than doing it in a simple way. Sometimes it helps but sometimes it does not and may turn out a very tedious job. In problems like this, it is easy to use this method.
Problem Loading...
Note Loading...
Set Loading...
12^12 = 2^24 * 3^12
As n must be a number which should be divisibe by 2^24 and 3^12 And we want smallest number which can be divided by 2^24 and 3^12 So n = 28!