Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Equation with Two Exponential Terms

Date: 06/27/2009 at 15:34:36
From: Dan
Subject: find ordered pair (a,b) for 3^a + 7^b giving a perfect square

Any perfect square can be expressed as n^2, find all ordered pairs 
for 3^a + 7^b which result in a perfect square answer.

I'm not sure where to begin.  I have an idea that there are several
situations to analyze.  For example if a and be are equal they can be
factored by a formula and if they are both even they are going to be
complex roots.

Date: 06/29/2009 at 08:36:01
From: Doctor Jacques
Subject: Re: find ordered pair (a,b) for 3^a + 7^b giving a perfect square

Hi Dan,

This is a very nice exercise about congruences.  Although the proof
does not require any elaborate concept, it requires a significant
amount of work--be prepared for a hard ride...

We are looking for solutions of:

  3^a + 7^b = n^2           [1]

where a, b, and n are non-negative integers.

We can first look at [1] as a congruence modulo 7:

  3^a = n^2   (mod 7)       [2]

Modulo 7, the quadratic residues (i.e., the squares) are 0, 1, 2, and
4, and 3 is not one of them.  And we also have

  3^6 = 1  (mod 7)          [3]

by Fermat's theorem.  This implies that a must be even.

[We could also look at congruences modulo 4 to deduce that b must be
odd, but we will not need that fact.]

As a is even, we may write a = 2k for some integer k.  We have:

        3^(2k) + 7^b = n^2
        n^2 - 3^(2k) = 7^b
  (n + 3^k)(n - 3^k) = 7^b       [4]

This means that the product on the LHS must be a power of 7, and
therefore each factor must also be a power of 7.

However, it is not possible to have both factors on the LHS divisible
by 7, as this would imply that their difference

  (n + 3^k) - (n - 3^k) = 2*3^k

would be divisible by 7, which is clearly impossible.  The only power
of 7 that is not a multiple of 7 is 7^0 = 1.  We may therefore
conclude that one of the factors must be 1, and this is obviously the
smaller factor; we have:

  n - 3^k = 1
        n = 3^k + 1               [5]

If we substitute that into [4], we obtain:

  2*3^k + 1 = 7^b
  2*3^k = 7^b - 1           [6]

and this means that 7^b - 1 must be twice a power of 3.

Let us look at the simple cases first.  If k = 0, we have 7^b - 1 = 2,
which is impossible.  If k = 1, we have:

  6 = 7^b - 1

which has the solution b = 1.  We will now show that this is the only
solution.  We may now assume that k > 1, and [6] shows that 7^b - 1
must be divisible by 9; in other words, we must have:

  7^b = 1    (mod 9)         [7]

Modulo 9, the powers of 7 are:

  m   | 0 1 2 3
  7^m | 1 7 4 1

and this shows that [7] will be satisfied if and only if b is a
multiple of 3.  We have:

  7^3 - 1 = 342 = 2*3^2*19

but this means that:

  7^3 = 1   (mod 19)

and we will have 7^b = 1 (mod 19) for all exponents b that are
multiples of 3; this is the same as saying that, if b is a multiple of
3, 7^b - 1 is a multiple of 19, which contradicts equation [6].

Therefore, the only solution is k = 1, a = 2 and b = 1, corresponding
to 3^2 + 7^1 = 4^2.

Please feel free to write back if you require further assistance.

- Doctor Jacques, The Math Forum
Associated Topics:
College Number Theory
High School Number Theory

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994-2013 The Math Forum