+0

# Find the largest prime number p such that when 2012! is written in base p, it has at least p trailing zeroes.

0
241
7

Find the largest prime number p such that when 2012! is written in base p, it has at least p trailing zeroes.

May 9, 2019

#1
+1

Find the largest prime number p such that when 2012! is written in base p, it has at least p trailing zeroes.

If you write any number in a different base then the number of zeros will be the number of times that base can be divided into the number

For example.   20 written in base 2 will have 2 zeros at the end because 20 can be divided by 2 twice and get an integer answer.

I have deleted what I wrote after this point because it was nonsense.  BUT

You should be able to use this initial fact to help determine the correct answer.

May 12, 2019
edited by Melody  May 12, 2019
#2
+1

Melody why is that? we can divide 2012! by 2 more than once

Guest May 12, 2019
#3
0

Yes, you are absolutely correct.  Great observation!

My last sentence is completely wrong.  (I willl delete it with an explanatory note)

I think you can still use the beginning of my explanation to determine the correct answer.  I may do it myself when I have a little more time.

May 12, 2019
#4
+2

Find the largest prime number p such that when 2012! is written in base p, it has at least p trailing zeroes.

The answer is 43 because 43^2 is the biggest squared prime number that is less than 2012!

I did work this our logically but BUT I will admit that it may be difficult for me to show this logic.

I will try

Say the number was not 2012! Say it is what ever number factorial that will work if

p is 2

1*2*3*4 = 1*2*3*2*2 = 3*2*2*2   this will have 3 trailing zeros when written in base 2 (there is no version with only 2 trailing zeros)

so if p=2 then it would have to be factorial 4.          Note that 2^2=4

Try p=3

I need the smallest factorial (X!) where X! written in base 3 has at least 3 trainling zeros. So I need at least 3^3 = 27 to be a factor

1*2*3*4*5*6*7*8*9 = 1*2*3*4*5*2*3*7*8*3*3 = 3^4 * 2*4*5*2*7*8  = 9!

when 9! is written in base 3 there will be 4 trailing zeros .. It is imposible to have only 3

Try p=5

I need the smallest factorial (X!) where X! written in base 5 has at least 5 trainling zeros. So I need at least 5^5  to be a factor

1*2*3*4*5*6*7*8*9*10* ..... 25

= (Some integer without 5 as a factor)* 5*1*   5*2  *  5*3  * 5*4  *  5*5

= (Some integer without 5 as a factor)* 5 *  5 *  5* 5  *  5*5

= (Some integer without 5 as a factor)* 5^6

when 25! is written in base 5 there will be 6 trailing zeros .. It is imposible to have only 5

Let me try and explan the general version.

Let the number be p

Consider  this
$$(p^2)!=1*2*......1p.......*2p........*(p-1)p.....*(pp) \\ (p^2)!=1*2*...1*2* ...*(p-1).....*p^{(p-1)}.....*p^2\\ (p^2)!=(\text{An interger without p as a factor}).....*p^{(p-1)}.....*p^2\\ (p^2)!=(\text{An interger without p as a factor}).....*p^{(p+1)}\\$$

Back to the original question

Find the largest prime number p such that when 2012! is written in base p, it has at least p trailing zeroes.

$$\sqrt{2012}\approx 44.8$$

The closest prime number less than 44.8 is 43

So  p=43

-------------------------------------------------------------------------

Lets check

$$2012! = \text{(Some integer that does not have 43 as a factor)}*43*2*43*3*43 *..........42*43*43*43\\ 2012! = \text{(Some integer that does not have 43 as a factor)}*43^{42}*43*43\\ 2012! =\text{(Some integer that does not have 43 as a factor)}*43^{44}\\ \text{When written in Base 43 2012! will have 44 trailing zeros.}$$

What about if p=47, maybe it will work too?

$$2012! = \text{(Some integer that does not have 47 as a factor)}*47*2*47*3*47 *..........42*47\\ 2012! = \text{(Some integer that does not have 43 as a factor)}*47^{42}\\ \text{When written in Base 47 2012! will only have 42 trailing zeros.}\\ \text {so Base 47 will definitely not work}$$

.
May 13, 2019
#5
+1

Hello Melody: I wrote a very short code to convert 2012! to base 43 in its entirety: Here are just the beginnings of the number and its trailing zeros. They count to 47 zeros.
(6, 38, 32, 10, 35............   14, 21, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

P.S. I also converted it to base 47 and it gives 42 zeros.

May 13, 2019
edited by Guest  May 13, 2019
#6
+1

Note: To count the number of trailing zeros of N! in any base above 36, simply divide N by the powers of the base that are <= N.

Example: 2012! in base 43, we simply divide:2012 / 43^1 + 2012 / 43^2 =46 + 1= 47 zeros. Just take the INTEGER part.

2012! in base 47: 2012 / 47^1 + 2012 / 47^2 = 42 + 0 = 42 zeros. [47^2 is > than 2012, hence = 0]

May 13, 2019
#7
+2

Yes that sounds reasonable.

You say there are 47 trailing zeros

Our number is  2012!

43^2 = 1849

Since 1849 is smaller than 2012 so I would expect there to be more than 44 trailing zeros when 2012! is written in base 43.

I know I have told you many times before but I really like your little lines of code that you figure out and run.

It is a really helpful check mechanism.

I'd really like it if you became a member.

You could call yourself  CodeDude    OR    Cplusplus ( I think C++ is the code you use??)   LOL

OR you could chose whatever you want.    May 14, 2019