Can you solve this?

Find number of ordered pairs ( m , n ) (m,n) where m and n are positive integers such that n 3 + 1 m n 1 \frac {n^3 + 1}{mn - 1} is an integer.


The answer is 9.

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.

5 solutions

Mihir Chakravarti
Feb 18, 2015

Suppose n 3 + 1 m n 1 = k \frac{n^3+1}{mn-1}=k where k k is a positive integer. Then n 3 + 1 = ( m n 1 ) k n^3+1=(mn-1)k and so it is clear that k 1 ( m o d n ) k\equiv -1\pmod{n} . So, let k = j n 1 k=jn-1 where j j is a positive integer. Then we have n 3 + 1 = ( m n 1 ) ( j n 1 ) = m j n 2 ( m + j ) n + 1 n^3+1=(mn-1)(jn-1)=mjn^2-(m+j)n+1 which by cancelling out the 1s and dividing by n n yields n 2 = m j n ( m + j ) n 2 m j n + m + j = 0 n^2=mjn-(m+j)\Rightarrow n^2-mjn+m+j=0 . The equation x 2 m j x + m + j = 0 x^2-mjx+m+j=0 is a quadratic. We are given that n n is one of the roots. Let p p be the other root. Notice that since n + p = m j n+p=mj we have that p p is an integer, and so from n p = m + j np=m+j we have that p p is positive.

It is obvious that j = m = n = p = 2 j=m=n=p=2 is a solution. Now, if not, and j , m , n , p j,m,n,p are all greater than 1 1 , we have the inequalities n p > n + p np>n+p and m j > m + j mj>m+j which contradicts the equations n p = m + j , n + p = m j np=m+j, n+p=mj . Thus, at least one of j , m , n , p j,m,n,p is equal to 1 1 .

If one of m , j m,j is 1 1 , without loss of generality assume it is j j . Then we have n p = m + 1 , n + p = m np=m+1, n+p=m . That is, n p n p = 1 ( n 1 ) ( p 1 ) = 2 np-n-p=1\Rightarrow (n-1)(p-1)=2 which gives positive solutions ( n , p ) = ( 3 , 2 ) , ( 2 , 3 ) (n,p)=(3,2),(2,3) . These give m = 5 m=5 and since we assumed j = 1 j=1 , we can also have m = 1 m=1 and j = 5 j=5 .

If one of n , p n,p is 1 1 , without loss of generality assume it is p p . Then we have n = m + j , n + 1 = m j n=m+j, n+1=mj . That is, m j m j = 1 ( m 1 ) ( j 1 ) = 2 mj-m-j=1\Rightarrow (m-1)(j-1)=2 which gives positive solutions ( m , j ) = ( 3 , 2 ) , ( 2 , 3 ) (m,j)=(3,2),(2,3) . These give n = 5 n=5 and since we assumed p = 1 p=1 , we can also have n = 1 n=1 and p = 5 p=5 .

From these, we have all solutions ( m , n ) = ( 2 , 2 ) , ( 5 , 3 ) , ( 5 , 2 ) , ( 1 , 3 ) , ( 1 , 2 ) , ( 3 , 5 ) , ( 2 , 5 ) , ( 3 , 1 ) , ( 2 , 1 ) (m,n)=(2,2),(5,3),(5,2),(1,3),(1,2),(3,5),(2,5),(3,1),(2,1) . Hence we have a total of 9 ordered pairs.

Kazem Sepehrinia
Apr 7, 2015

Hey, I like this problem.

First note that if m n 1 n 3 + 1 mn-1|n^3+1 then m n 1 m 3 n 3 1 + n 3 + 1 = n 3 ( m 3 + 1 ) mn-1|m^3n^3-1+n^3+1=n^3(m^3+1) It follows that m n 1 m 3 + 1 mn-1|m^3+1 because gcd ( m n 1 , n 3 ) = 1 \gcd(mn-1, n^3)=1 , so if ( m , n ) (m,n) is an answer ( n , m ) (n,m) will be too. If n = m n=m we get n 3 + 1 m n 1 = n 3 + 1 n 2 1 = n + 1 n 1 \frac{n^3+1}{mn-1}=\frac{n^3+1}{n^2-1}=n+\frac{1}{n-1} So n 1 1 n-1|1 and n = 2 n=2 . Therefore ( 2 , 2 ) (2,2) is an answer and from now on we can suppose m > n m>n . Let n = 1 n=1 , it gives m = 2 , 3 m=2,3 , we get four answers from here: ( 1 , 2 ) , ( 2 , 1 ) , ( 1 , 3 ) , ( 3 , 1 ) (1,2),(2,1),(1,3),(3,1) Note that if n 3 + 1 m n 1 = r \frac{n^3+1}{mn-1}=r then r n 1 r\stackrel{n}{\equiv} -1 , and r r have the form of k n 1 kn-1 for some positive integer k k . Since m > n m>n k n 1 = n 3 + 1 m n 1 < n 3 + 1 n 2 1 = n + 1 n 1 k n 1 < n + 1 n 1 k < 1 + 1 n + 1 n ( n 1 ) 2 k < 2 kn-1=\frac{n^3+1}{mn-1}<\frac{n^3+1}{n^2-1}=n+\frac{1}{n-1} \\ kn-1<n+\frac{1}{n-1} \\ k<1+\frac{1}{n}+\frac{1}{n(n-1)} \le 2 \\ k<2 Thus k = 1 k=1 and we have ( n 1 ) ( m n 1 ) = n 3 + 1 (n-1)(mn-1)=n^3+1 , hence n 1 n 3 + 1 n-1|n^3+1 or n 1 n 3 + 1 ( n 3 1 ) = 2 n 1 2 n-1|n^3+1-(n^3-1)=2 \\ n-1|2 As a result n = 2 n=2 or n = 3 n=3 which gives us 2 m 1 = 9 2m-1=9 or 2 ( 3 m 1 ) = 28 2(3m-1)=28 and both of them leads to m = 5 m=5 , so we get four other answers from here: ( 2 , 5 ) , ( 5 , 2 ) , ( 3 , 5 ) , ( 5 , 3 ) (2,5),(5,2),(3,5),(5,3) .

Caleb Townsend
Feb 18, 2015

I'm going to hazard a guess that there are no solutions where m m or n n is greater than 1000. 1000. Then this is actually very simply solved by checking all the ordered pairs ( m , n ) (m, n) for positive integers m m and n n under 1000.

public class CubicSquareRatio
{
    public static void main(String[] args)
    {
        for (double length = 5.0; length < 1000.0; length++)
        {
            int count = 0;
            for (double m = 1; m < length; m++)
                for (double n = 1; n < length; n++)
                {
                    if (((n * n * n + 1.0)/(m * n - 1.0)) % 1.0 == 0.0)
                        count++;
                }
            System.out.println(count);
        }
    }
}

Indeed, it prints " 5 5 " for length = 5.0, and " 9 9 " for every length from 6.0 to 999.0. Unless there is some solution with m 1000 m \geq 1000 or n 1000 n \geq 1000 (in which case there would probably be infinitely many solutions), there are only the 9 \boxed{9} solutions found.

Hi bro . Nice solution .

I tried copying your code in my Netbeans IDE 6.5.1 , it show that inner classes cannot have static declarations . Can you please help ?

Arpit Agarwal - 6 years, 3 months ago

Log in to reply

Very strange! Before we throw out the whole kitchen to fix the sink, have you taken some preliminary debugging steps?

  1. Make sure the program is identical to my code.
  2. Make sure the file name and class name are CubicSquareRatio, .java and .class respectively.
  3. Make sure the classes and methods have the right keywords in the right order, e.g. public static void, etc.

If none of those help, you will have to be creative in debugging. I like using IDEs for fast programming, but if I can't resolve a debug issue immediately, I like to write with notepad++ and compile from the command line instead. IDEs can sometimes have specific problems. I am not familiar with netbeans, but it is possible that it creates the class on the fly so you don't have to write it out; if that's the case, simply removing the lines

public class CubicSquareRatio (delete)
{ (delete)
        ...
} (delete)

might work.

Caleb Townsend - 6 years, 3 months ago

Log in to reply

I got the program to work :) But here's the output .

run: 5 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 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9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9

How did you decide that the answer is 9 ? This is the last question that I have, plz answer it:)

Arpit Agarwal - 6 years, 3 months ago

Log in to reply

@Arpit Agarwal Basically, the program finds the total number of solutions where m m and n n are both less than double length; The program has a main loop that increases length by 1.0 1.0 each time and finds the total number of solutions again. Every time it does this, it prints out the total number of solutions found.

When length = 5.0 , \text{length} = 5.0, it has found 5 5 unique solutions. For every iteration after that, though, it has found 9 9 solutions. The program prints out almost 1000 1000 9 9 's, meaning if we check only the integers from 1 1 to 1000 , 1000, we will only find 9 9 solutions, and it hasn't changed since we only checked the integers from 1 1 to 5. 5. Since the number of solutions hasn't changed for almost 1000 1000 new tries, I inferred that it will not change again, no matter how many more numbers we try.

To further illustrate the point, try starting length \text{length} at 1.0 1.0 instead. I started at 5.0 5.0 in my program to save a bit of time.

for (double length = 1.0; length < 1000.0; length++)
{
    ...
}

It should print 0 0 3 5 5 9 9 9 9 9 . . . 0\ 0\ 3\ 5\ 5\ 9\ 9\ 9\ 9\ 9\ ... meaning there are 0 0 solutions where both m m and n n are less than 1 , 1, 0 0 solutions where both m m and n n are less than 2 , 2, 3 3 solutions where both m m and n n are less than 3 , 3, 5 5 solutions where both m m and n n are less than 4 , 4, 5 5 solutions where both m m and n n are less than 5 , 5, and 9 9 solutions where m m and n n are less than any integer from 6 6 to 999. 999. This is why I inferred there are only 9 9 solutions.

Caleb Townsend - 6 years, 3 months ago

Log in to reply

@Caleb Townsend Thanks bro, the last part of your answer explained it all :) +1

Arpit Agarwal - 6 years, 3 months ago

Even after you hazard a guess, you should try and see if you can prove your guess.

Calvin Lin Staff - 6 years, 3 months ago
Priyanshu Mishra
Sep 26, 2015

Note that ( m , n ) (m, n) is a solution iff

m 2 n 2 + m n + 1 + n 3 + 1 m n 1 = n 3 ( m 3 + 1 ) m n 1 \large\ { m }^{ 2 }{ n }^{ 2 } + mn + 1 + \frac { { n }^{ 3 } + 1 }{ mn - 1 } = \frac { { n }^{ 3 }({ m }^{ 3 } + 1) }{ mn - 1 }

is an integer. Since g c d ( n , m n 1 ) = 1 gcd(n, mn - 1) = 1 , this occurs iff m 3 + 1 m n 1 \frac { { m }^{ 3 } + 1 }{ mn - 1 } is a solution. That is, ( m , n ) (m, n) is a solution iff ( n , m ) (n, m) is a solution. Suppose ( m , n ) (m, n) is a solution and m n > 1 mn > 1 ; defining q q as in the current solution, we see that q < n q<n . Further, since
( n 2 1 ) 2 n 3 + 1 { ({ n }^{ 2 }\quad -\quad 1) }^{ 2 }\quad \ge \quad { n }^{ 3 }\quad +\quad 1 for n 2 n \ge 2 , we see that q < n q < n . Similarly, if m = n > 2 m = n > 2 , we get q < n q < n .

Thus the following steps

( i ) (i) If m < n m < n , interchange m m and n n ,\

( i i ) (ii) If m > n > 1 m > n > 1 or m = n > 2 m = n > 2 , replace ( m , n ) (m, n) by ( q , n ) (q, n) ,

starting from any solution we can always reduce to a smaller solution untill we get to either m = n = 2 m = n = 2 or n = 1 n = 1 .

In the latter case we have m = 2 o r 3 m = 2 {or} 3 . Backtracking gives the chain of solutions

( 3 , 5 ( ( 5 , 3 ) ( 1 , 3 ) ( 3 , 1 ) , ( 2 , 5 ) ( 5 , 2 ) ( 1 , 2 ) ( 2 , 1 ) (3,5(\rightarrow \quad (5,3)\quad \rightarrow \quad (1,3)\quad \rightarrow \quad (3,1),\quad (2,5)\quad \rightarrow \quad (5,2)\quad \rightarrow \quad (1,2)\quad \rightarrow \quad (2,1) and the single solution ( 2 , 2 ) (2, 2) .

Thus these 9 9 pairs are all solutions to the problem.

Answer: 9 \boxed{9} .

Mehul Chaturvedi
Feb 26, 2015

Python

1
2
3
4
5
6
N=0
for n in range(2,999):
    for m in range(1,999):
        if int((n**3+1.0)/(m*n-1))==(n**3+1.0)/(m*n-1):
            N+=1
                print N,[m,n] 

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...