Checking the divisibility of a factorial

When Madin learnt about factorials, he was delighted that they had so many factors since k ! = 1 × 2 × 3 × × k k! = 1 \times 2 \times 3 \times \ldots \times k . He knew that k ! k! would be divisible by any positive integer that was smaller than k k , but wasn't certain about the larger integers.

Can you find the number of integers n n such that 2 n 100 2\leq n\leq 100 and ( n 1 ) ! (n-1)! is not divisible by n 2 n^2 ?


The answer is 42.

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.

6 solutions

Happy Melodies
Jan 7, 2014

When we first see divisibility questions like this (especially with factorials), one idea to approach the question could be using primes. This is because for a factorial n ! n! , if prime p > n p>n , then p n ! p \nmid n! as there are no prime factors p p in n ! n! . (This is one case of our question too!)

So, firstly, as many other number theory questions, let's think of cases to split our solution into: (the bold sentence/phrase indicates the Case)

Case 1 A similar idea as mentioned above: Let n n be a prime. We know n > n 1 n > n-1 , hence it follows that n 2 ( n 1 ) ! n^2 \nmid (n-1)! . Keeping in mind the condition of 2 n 100 2 \leq n \leq 100 . There are 25 25 primes less than 100 100 .

Case 2 * Let n = 2 × p n = 2 \times p where p p is a prime *. Then, observe that there will only be 1 1 factor of p p in ( n 1 ) ! (n-1)! since n 1 < n = 2 p n-1 < n = 2p . Thus, n 2 = 2 2 × p 2 ( n 1 ) ! n^2 = 2^2 \times p^2 \nmid (n-1)! . There are 15 15 primes such that 2 n = 2 p 100 2 \leq n = 2p \leq 100 .

Case 3 There are 2 2 exceptions that satisfy the condition of the question but do not belong to either Case 1 or 2. They are n = 8 , 9 n = 8, 9 , thus 2 2 solutions in Case 3. When n = 8 = 2 3 n=8 = 2^3 , ( n 1 ) ! = 7 ! (n-1)! = 7! has 7 2 + 7 4 = 3 \lfloor\frac{7}{2}\rfloor + \lfloor\frac{7}{4}\rfloor = 3 factors of 2 2 , hence, n 2 = 8 2 = 2 6 7 ! n^2 = 8^2 = 2^6 \nmid 7! . Similarly, for the solution n = 9 = 3 2 n=9 = 3^2 , ( n 1 ) ! = 8 ! (n-1)! = 8! has only 8 3 = 2 \lfloor\frac{8}{3}\rfloor = 2 factors of 3 3 . Hence, n 2 = 9 2 = 3 4 8 ! n^2 = 9^2 = 3^4 \nmid 8!

(I tested out the first 10 10 values of n n and observed the exceptions. So, how do I know that there are only 2 2 exceptions? Well, testing the next powers of 2 2 and 3 3 which are n = 2 4 = 16 n=2^4 = 16 and n = 3 3 = 27 n=3^3 =27 respectively, will show that they do not satisfy the conditions.)

Hence, the number of integers n n satisfying all conditions in the question

= 25 + 15 + 2 = 42 = 25 +15 +2 = \boxed{42} .

To show that other numbers are not possible: show that composite numbers k k of form k = m n k=m*n , where m , n m,n are coprime have k 2 ( k 1 ) ! k^2 | (k-1)! [Show that m 2 , n 2 m^2, n^2 both divide ( k 1 ) ! (k-1)! ], while prime powers greater than 8 , 9 8,9 fulfil the same conditions too. (For higher powers of 2 , 3 2,3 you can do as shown above, higher primes can be shown in an analogous way as m n m*n above)

In general, the integers n n where n 2 ( n 1 ) ! n^2\nmid(n-1)! are where n n is one of the following: a prime, double a prime or 8 , 9 8,9

Jared Low - 7 years, 5 months ago

Can somebody help me find solutions to this question?

Anagram Cracker!!

Anagrams are problems related to shuffled letters which are needed to be arranged and made into perfect meaningful sentences without repeating the letters (letters can be used only once).

Here are some anagrams which you need to crack:

1) tuteauaewribeifslh

2) geaperioitrdspawsagnhabineod

3) enaednenetorfyimrw

Remember to arrange and make a meaningful sentence (one sentence from each group of letters), not single word. If you are able to solve this anagrams please inform me the answers as well as how you found the solutions to the anagrams.

Details and assumptions:

Example:

"My name is Anil" can be written in the form of group of letters as:

meailaysmnni

Saurabh Mallik - 7 years, 2 months ago
Riccardo Zanotto
Jan 6, 2014

Given an integer n n , let α : = v p ( n ) \alpha:=v_p (n) be the number of factors of a prime p p in n n . Then v p ( n 2 ) = 2 α v_p (n^2)=2\alpha . We want to calculate v p ( ( n 1 ) ! ) v_p ((n-1)!) and in order to do this we use the Legendre-De Polignac identity and we get v p ( ( n 1 ) ! ) = i 1 n 1 p i \displaystyle v_p ((n-1)!)=\sum_{i\ge1}\left\lfloor\frac {n-1}{p^i}\right\rfloor but we have the trivial inequality n p α n\ge p^\alpha , so v p ( ( n 1 ) ! ) i 1 p α 1 p i = i = 1 α 1 p α i 1 \displaystyle v_p ((n-1)!)\ge\sum_{i\ge1}\left\lfloor\frac {p^\alpha-1}{p^i}\right\rfloor=\sum_{i=1}^{\alpha-1} p^{\alpha-i}-1 . We can transform the last sum into p α 1 p 1 α \displaystyle\frac {p^\alpha-1}{p-1}-\alpha by the formula for the sum of a geomteric progression. The numbers that satisfy the statement in the text are those for which v p ( n 2 ) > v p ( ( n 1 ) ! ) v_p (n^2)> v_p ((n-1)!) , which is 2 α > p α 1 p 1 α 2\alpha>\frac {p^\alpha-1}{p-1}-\alpha , ie 3 α > p α 1 p 1 3\alpha>\frac {p^\alpha-1}{p-1} If α = 1 \alpha=1 this inequality holds for every prime. Then if n is a prime, it satisfies the problem; if n = k p n=kp with k not divisible by p, then n 2 n^2 has 2 factors p, while ( n 1 ) ! (n-1)! has at least k-1 factors p; so the condition of the problem is satisfied if and only if k is 2 (or 1).

If α = 2 \alpha=2 then p can be only 2 or 3 and it is easily checked that 4 and 9 are ok, while 4k and 9k aren't ok if k 2 k\ge2

If α = 3 \alpha=3 then p can be only 2, and we see that 8 is ok, while 8k isn't.

If α 4 \alpha\ge4 then there are no solutions. So, the only values for n are p, 2p, 4, 8, 9; the primes under 100 are 25, the primes such that 2 p 100 2p\le100 are 15. So there are 25 + 15 + 2 = 42 25+15+2=\boxed {42} values for n that satisfy the problem (4 is already counted as 2p).

Why aren't there any solutions for α 4 \alpha \geq 4 ?

Sreejato Bhattacharya - 7 years, 5 months ago

Log in to reply

You easily see that because on the right you have an exponential formula (increasing wrt α \alpha and wrt p) while on the left you have a linear expression. So for fixed α \alpha the minimum of the rhs is at p = 2 p=2 ; but for α = 4 \alpha=4 the inequality is false, and so it is for every other bigger α \alpha (since the rhs is increasing in α \alpha )

Riccardo Zanotto - 7 years, 5 months ago

What's Legendre-De Polignac identity ?

minimario minimario - 7 years, 5 months ago

Log in to reply

Legende Formula

Zi Song Yeoh - 7 years, 5 months ago
Pebrudal Zanu
Jan 6, 2014

Hi, I am beginner in python

I try to solve this problem use python

thisi is my code

   import math

   for n in range (2,101):

if math.factorial(n-1)%n**2==0:

    print n

Output:

12 15 16 18 20 21 24 25 27 28 30 32 33 35 36 39 40 42 44 45 48 49 50 51 52 54 55 56 57 60 63 64 65 66 68 69 70 72 75 76 77 78 80 81 84 85 87 88 90 91 92 93 95 96 98 99 100

But, I can't count direct the answer, and I count one by one.

Can you help me, guy?s??

  1. This is Number Theory, so you shouldn't be using programs.

  • You are counting the #s that don't satisfy the property said in the problem.

  • You can use a counter; first write the line count=0, and have it count up 1 every time the condition is satisfied. Your final program might look something like this. (Hopefully, 42 will be printed, but you can check yourself)

     import math
    
     count=0
    
     for x in range(2, 101):
    
        if math.factorial(x-1)%(x**2)!=0:
    
                count+=1
    
      print count
    

  • minimario minimario - 7 years, 5 months ago

    Log in to reply

    Thank you very much... I am interested for learning programming. So, I try to solve this problem not number theory concept, I am sorry.

    pebrudal zanu - 7 years, 5 months ago

    Log in to reply

    Go to Project Euler for questions based on math + programming

    Ruchir Mehta - 7 years, 4 months ago
    Saurabh Mallik
    Mar 28, 2014

    Can somebody help me find solutions to this question?

    Anagram Cracker!!

    Anagrams are problems related to shuffled letters which are needed to be arranged and made into perfect meaningful sentences without repeating the letters (letters can be used only once).

    Here are some anagrams which you need to crack:

    1) tuteauaewribeifslh

    2) geaperioitrdspawsagnhabineod

    3) enaednenetorfyimrw

    Remember to arrange and make a meaningful sentence (one sentence from each group of letters), not single word. If you are able to solve this anagrams please inform me the answers as well as how you found the solutions to the anagrams.

    Details and assumptions:

    Example:

    "My name is Anil" can be written in the form of group of letters as:

    meailaysmnni

    Shivang Jindal
    Feb 27, 2014

    Well!. This is a oldProblem. Was also asked in INMO. See here, INMO

    Danny He
    Jan 6, 2014

    Clearly if n n is prime then the condition is met, however if n = 2 p n=2p for some prime p p then the condition is also met because there is only one multiple of p p in ( 2 p 1 ) ! \left(2p-1\right)! thus 4 p 2 4p^2 will never divide ( 2 p 1 ) ! \left(2p-1\right)!

    Now suppose either n = p k n = pk for some prime p p and some non-negative integer k > 2 k > 2 . Clearly since there are at least two multiples of p p in ( 2 p 1 ) ! \left(2p-1\right)! then k 2 p 2 k^2p^2 must be able to divide ( 2 p 1 ) ! \left(2p-1\right)! . Same argument can be made k k -centric.

    Thusly no composite number is eligible and so either n n is prime or the double of a prime for 2 n 100 2 \leq n \leq 100 which means there are 42 42 values of n n for which n 2 n^2 does not divide ( n 1 ) ! \left(n-1\right)!

    What about n = 8? n = 9?

    Michael Tang - 7 years, 5 months ago

    Log in to reply

    What about them? Neither work.

    Danny He - 7 years, 5 months ago

    I am very sorry, they do work I made a huge error when I was checking them sorry

    Danny He - 7 years, 5 months ago

    ... and so either is prime or the double of a prime for ...

    If that were true, there would only be 25+15=40 values for n. Cf Michael Tang's comment.

    Peter Byers - 7 years, 5 months ago

    Log in to reply

    Evidently I had counted the pairs wrong, I'm sorry I will work on fixing this solution and add the extension as a comment as soon as I have it. Sorry for the inconvenience

    Danny He - 7 years, 5 months ago

    EDIT: another case was missed in the solution there was an error made whilst counting the primes.

    If n = p a n = p^a for some prime p p and some positive integer a 2 a \geq 2 then there arise two more solutions. If a = 2 a = 2 then there are p 1 p-1 values of p p in ( p a 1 ) ! \left(p^a-1\right)! so if we had 4 > p 1 4 > p-1 then we would have a value of n n such that the requirements are met.

    p 1 = 1 p = 2 , p-1 = 1 \Rightarrow p = 2, so n = 4 n = 4 which has already been counted

    p 1 = 2 p = 3 , p-1 = 2 \Rightarrow p=3, so n = 9 n = 9

    p 1 = 3 p = 4 p-1 = 3 \Rightarrow p=4 but 4 4 isn't prime hence there is a contradiction and p 1 = 3 p-1 = 3 is ignored.

    Now consider a = 3 a = 3 This means there are p 2 1 p^2 -1 number of p p in ( p 3 1 ) ! \left(p^3-1\right)! and so if we had 6 > p 2 1 6 > p^2 - 1 then we'd have a value of n n that satisfies the conditions.

    p 2 1 p^2 -1 must be an integer and thus can only be 3 3

    p 2 1 = 3 p = 2 , p > 0 n = 8 p^2 - 1 = 3 \Rightarrow p = 2, \because p>0 \Rightarrow n=8

    Now consider a 4 a \geq 4 There will be p a 1 1 p^{a-1} -1 number of p p in ( p a 1 ) ! \left(p^a - 1\right)! We require 2 a > p a 1 1 2a > p^{a-1} - 1 however if a > 5 a >5 then p a 1 1 > 2 a p^{a-1} - 1> 2a and if a = 4 a = 4 then only for p = 2 p=2 is 2 a > p a 1 1 2a > p^{a-1} - 1

    However, p = 2 n = 2 4 = 16 p = 2 \Rightarrow n = 2^4 = 16 which does not in fact work. Thus the extra solutions are n = 8 , 9 n = 8,9 which brings the total up to 42 42

    Danny He - 7 years, 5 months ago

    0 pending reports

    ×

    Problem Loading...

    Note Loading...

    Set Loading...