fibept, "IRC nick", worked the following problem at a high school math team meet:
Find the smallest positive integer solution to 3 n2 - 37 m2 = -1
m=1 is not a solution but m=2 gives n=7 which is a solution. In this case guessing works right away. landen, "IRC nick", wrote up the following which shows how to find any solution of this equation. The write-up tries to avoid using number theory which a HS student is unlikely to know.
3 n2 - 37 m2 = 2 has no solutions
It is surprisingly easy to show this has no solutions and the methods used in the steps are common in other problems. We will show that no combination of having m and n be odd or even can work. Therefore, the assumption of having solutions leads to a contradiction.
One of the ways of proving that an equation in integers has no solutions is to separate all solutions into a finite number of classes. Then prove that the theorem is impossible for each of the classes. In this case the classes were: one even and one odd, both even, and both odd. Then for each class we get to use special properties of the members of the class. In the both odd case the property that the square of an odd number is 1 more than a multiple of 8 was used. To use this fact requires you to know in advance this famous property of odd squares. It is not enough to be able just to prove this property of odd squares. You need to be familiar in advance so you can steer the proof toward using it.
If you know "mod arithmetic" you can get your computer to try to prove there is no solution. If there is a solution at all, then there is a solution mod every integer. So just take some moduli, r = 2,3,4,5 etc., and try all possible values of m and n for each modulus r. If you find even one r for which there is no solution then you have proved that there are no integer solutions. Not surprisingly, working (mod 8), shows 3 n2 - 37 m2 = 2 has no solution.
3 n2 - 37 m2 = -1 has the solution n = 7; ma = 2 which is easy to find by searching. We can rewrite the equation as:
m = sqrt(( 3 n2 + 1) / 37)
Since the expression inside the sqrt is positive, we have a real number value for m for any positive n. An obvious question is whether m can be an integer for integer values of n besides 7. We can show that this particular equation has an infinite number of integer solutions in a simple pattern. Write the first solution with this notation:
p0 = [7, 2] = [n0, m0] with n0 = 7 and m0 = 2.
pk = [nk, mk] means the kth solution to our equation, using this notation.
In problems of this type the numbers involved get real big real fast, so I used a computer to try values of n and then check if m is an integer. This lead to the next smallest solution:
p1 = [4137, 1178] and we can check that 3*41372 - 37*11782 = -1
A powerful idea for solving problems is the concept of recurrence, recurrence means getting a new solution by mathematical operations on old ones. In this case we can compute a new solution pk+1 from pk by somehow "guessing", see below, the following linear recurrence formulas:
nk+1 = 295 nk + 1036 mk
mk+1 = 84 nk + 295 mk
As an example we can get p1 from p0 as:
n1 = 295 * 7 + 1036 * 2 = 4137
m1 = 84 * 7 + 295 * 2 = 1178
We can prove the recurrence above gives new solutions in general by computing:
3 (295 nk + 1036 mk)2 - 37 (84 nk + 295 mk)2 =
3 nk2 - 37 mk2 = -1
Since there are infinitely many solutions, we can get ones with big numbers. High precision arithmetic is required. Here are several solutions to: 3 n2 - 37 m2 = -1 which were computed using PARI-GP and the method above:
p0 = [7 , 2]
p1 = [4137, 1178]
p2 = [2440823, 695018]
p4 = [849645604647, 241934375762]
p20 = [183168183901089799048455793355239948773846490752959735207,
52156663895155063903713009004972842992229533347630150802]
p100 =
[8529256227460311775900793417603008843261135932506976838962787170594516948505 62636158868176112601645816762963907378513852247600033393951022366392415432729 45413008063311398248229184846717207182884722557831824917740638614751837542228 180277330979660372257018408031662371741299476007, 24286835238347250628644322376131853912232361197483042182437237729965212689843 29532929555535913900290876034100009055890020758590800619826566726835269985096 96586002204835419591465850937439142019533832072388226376755517332976996208656 77179050964717762235850747322629402300259554002]
There is a powerful general theory of integer solutions to quadratic forms of the type:
a n2 - b m2 = q, given a and b naturals and q an integer.
Unfortunately, the theory is not covered in a typical introduction to number theory course and requires abstract algebra and linear algebra as background. Fortunately, given an explicit equation you can easily find all the solutions that there are using recurrence techniques. It may not seem elegant to get your computer to find a couple of solutions to 3 n2 - 37 m2 = -1 using brute force but it took less than 2000 tries using no optimizations (easy to program). Once the recurrence relation is found big solutions are obtained fast. Even p100 was printed instantly. There are famous examples such as n2 - 61 m2 = 1, which has n = 1766319049; m = 226153980 as the smallest solution. With a little more programming you can avoid brute force search and use the chakravala method of Bhaskara II discovered in 1150 C.E. This method uses clever manipulation but does not require advanced math beyond typical HS. The same URL above also discusses the use of continued fractions to solve these equations. Continued fractions are probably the easiest to program but require more theory (easy) to learn.
Created on ... March 20, 2003