All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Squares and Cubes (Posted on 2003-12-06) Difficulty: 2 of 5
What are the two smallest positive whole numbers the difference of whose squares is a cube and the difference of whose cubes is a square ?

See The Solution Submitted by Ravi Raja    
Rating: 3.7500 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Analytic General Solution | Comment 17 of 21 |
I am ignoring trivial solutions where the two numbers are equal, although strictly speaking they are allowed by the question.

The following gives all solutions, a little thought will show that 10, 6 is the smallest solution.


Choose x, y, n positive integers where x and y have no common factors and y>x>0. The following algorithm gives a different solution for each choice of x, y and z. All solutions are given by this method so there¡¦s a one to one relationship between choices of x, y and z and solutions.

I need to define a few bits of notation, although I only use some of them in the proof.

x^y x raised to the power of y
e.g. 2^3 = 8, 5^2 = 25

x rem n the remainder when x is divided by n,
E.g. 9 rem 2 = 1, 9 rem 5 = 4.

x „k y mod n x and y give the same remainder when divided by n,
i.e. (x rem n) = (y rem n)
E.g. 9 „k 14 mod 5

x | y x divides y exactly leaving no remainder
i.e. y rem x = 0, x „k 0 mod y
E.g. 5 | 10, 3| 9, 3 | 15

x ~| y x does not divide y exactly
i.e. not (x | y)
E.g. 3 ~| 10

x, y co-prime x and y have no common factors
e.g. 3, 4 are co-prime,
9, 15 are not co-prime because they are both divisible by 3


Put z = 3y^2 ¡V x^2.

Now for the hard bit, you need to factorise x, y and z into their prime factors. For each prime factor also calculate the index, that is the highest power that divides the number. For example 12 = 2^2 * 3 so the prime factors are 2 and 3 with indices 2 and 1 respectively.

We are going to calculate a multiplier, called H, which will turn x and y into the basis for a solution.

Start with H = 1.

For each prime, p, that divides y with index I adjust H as follows.

If p = 2 and 3 | I then
multiply H by 2^6
else
multiply H by 2^( 4I rem 6 )


If 3 divides x with index I, adjust H as follows.
Multiply H by p^( 3(I rem 2) )

For each prime, p, that divides x with index I, adjust H as follows.
Multiply H by p^( I rem 6)

For each prime, p, that divides z with index I, and does not dived x, adjust H as follows.
Multiply H by p^( 3(I rem 2) )


Now put
a = (y + x) * H * n^6 / 2
b = (y - x) * H * n^6 / 2

You will find that a^2 ¡V b^2 is a cube and a^3 ¡V b^3 is a square.



Example 1:
Choose y = 2, x = 1.

z = 3 * 2^2 + 1^2 = 3*4 + 1 = 13

2 | y with py = 1 so choose ph = 4

13 | z and 13 ~| x with pz = 1 so choose ph = 3

This gives h = 2^4 * 13^3

a = h(y + x)/2 = 2^4 * 13^3 * (2 + 1)/2 = 2^3 * 3 * 13^3
b = h(y - x)/2 = 2^4 * 13^3 * (2 - 1)/2 = 2^3 * 13^3

a^2 ¡V b^2 = 2^6 * 13^6 * (9 ¡V 1) = 2^9 * 13 ^6 = (2^3 * 13^2)^3
a^3 ¡V b^3 = 2^9 * 13^9 * (27 ¡V1) = 2^9 * 13^9 * 26
= 2^9 * 13^9 * 2 * 13
= 2^10 * 13^10
= (2^5 * 13^5)^2

Example 2:
Choose y = 4, x = 1

z = 3 * 4^2 + 1 = 49 = 7^2

2 | y with py = 2 so choose ph = 2

7 | z and 7 ~| x with pz = 2 so choose ph = 0.

This gives h = 2^2 = 4.

a = h(y + x)/2 = 4( 4 + 1 )/2 = 10
b = h(y ¡V x)/2 = 4( 4 ¡V 1 )/2 = 6

10^2 ¡V 6^2 = 64 = 4^3
10^3 ¡V 6^3 = 784 = 28^2





Proof


If a and b are a solution then we have

1. a^2 ¡V b^2 = c^3
2. a^3 ¡V b^3 = d^2

Put
3. h = hcf (a - b, a + b)
4. x = (a ¡V b)/h
5. y = (a + b)/h
6. Z = 3y^2 + x^2

Reverse mapping is
7. a = h(y + x)/2
8. b = h(y - x)/2

So
9. h^2 xy = c^3
10. h^3 xZ = ( 2d )^2

Note that multiplying x and y by a sixth power will give another solution, so we should just look for solutions where h is minimal. We can then multiply by n^6 to give other solutions. This will always give unique solutions because (hx/hy) = x/y is uniquely determined by x and y, remember x and y are co-prime.

We are now going to consider how many times a prime number, p, divides into each of the numbers in the equation.

We define px to be the number of times p divides into x, py to be the number of times p divides into y and pz to by the number of times p divides into z.

9. => 3 | px + py for all primes, p, which divide x or y.


Considering 10. we know that h^3 xZ is a square. As we are going for a minimal solution we need only consider factors of x, y and Z.

p | y => 3ph = 2pd „Æ ph „k 0 mod 2
3 | 2ph + py „Æ ph „k py mod 3

„Æ ph „k 4py mod 6

p | x and p <> 3
=> 3ph + px = 2pd „Æ ph „k px mod 2
3 | 2ph + px „Æ ph „k px mod 3

„Æ ph „k px mod 6

p | x and p = 3
„Ã 3ph + 1 + px = 2pd „Æ ph „k px + 1 mod 2
3 | 2ph + px „Æ ph „k px mod 3

„Æ ph „k 3px mod 6

p | Z, p ~| x (p could divide x if p = 3)
=> 3ph + pZ = 2pd „Æ ph „k pZ mod 2 where Z = (3y^2 + x^2)/h^2
3 | 2ph „Æ ph „k 0 mod 3

„Æ ph „k 3pZ mod 6

This ensures that h^ 3 xZ is a square. We have also to make sure it is an even square. This will be true if any of the following are true:

i) x is even.
ii) x and y are both odd, which makes Z even.

This leaves the case where y is even and x is odd. x and Z will be odd so we must make sure that h is even. This is the first case where p = 2 and p | y. We have ph „k 4py mod 6. We must ensure ph is not zero. This can only be true if py is divisible by 3 which gives ph „k 0 mod 6. So in this case we must choose ph = 6, rather than zero.

So for any co-prime x and y we have a unique minimal way of choosing h as follows.

If p | y then
if p = 2 and 3 | py choose ph = 6
else choose ph = 4py rem 6

If p | x and p <> 3 choose ph = px rem 6

If p | x and p = 3 choose ph = 3px rem 6

If p | Z and p ~| x choose ph = 3pZ rem 6


Example 1:
Choose y = 2, x = 1.

z = 3 * 2^2 + 1^2 = 3*4 + 1 = 13

2 | y with py = 1 so choose ph = 4

13 | z and 13 ~| x with pz = 1 so choose ph = 3

This gives h = 2^4 * 13^3

a = h(y + x)/2 = 2^4 * 13^3 * (2 + 1)/2 = 2^3 * 3 * 13^3
b = h(y - x)/2 = 2^4 * 13^3 * (2 - 1)/2 = 2^3 * 13^3

a^2 ¡V b^2 = 2^6 * 13^6 * (9 ¡V 1) = 2^9 * 13 ^6 = (2^3 * 13^2)^3
a^3 ¡V b^3 = 2^9 * 13^9 * (27 ¡V1) = 2^9 * 13^9 * 26
= 2^9 * 13^9 * 2 * 13
= 2^10 * 13^10
= (2^5 * 13^5)^2

Example 2:
Choose y = 4, x = 1

z = 3 * 4^2 + 1 = 49 = 7^2

2 | y with py = 2 so choose ph = 2

7 | z and 7 ~| x with pz = 2 so choose ph = 0.

This gives h = 2^2 = 4.

a = h(y + x)/2 = 4( 4 + 1 )/2 = 10
b = h(y ¡V x)/2 = 4( 4 ¡V 1 )/2 = 6



Comments:

1. I think this could possibly be simplified by putting h = hcf( a, b ) rather than hcf ( a + b, a ¡V b). They are the same except for a factor of 2. This could avoid the nasty treatment of 2 differently when it divides y.

2. A little consideration will show that 10, 6 is the smallest non-trivial solution.

3. This approach is a bit nasty as you have to factorise into prime factors, which is not exactly pretty from a mathematical viewpoint and is also slow from a computing viewpoint (if you care about that). There may well be a prettier solution, but I haven¡¦t found one yet.

  Posted by Stephen Morris on 2003-12-14 21:37:55
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information