Are there positive integers n,p such that 3^n = 2^p - 1?. Plus related question.

I was wondering if there’s any positive integer power of 3 which is 1 less than a positive integer power of 2. The powers don’t have to be the same.

3[sup]n[/sup] = 2[sup]p[/sup] -1 where n,p are positive integers.

I wrote a program looking for any suitable n/p values, but I couldn’t find any. My program was limited to going up to 3[sup]647[/sup]

I noticed that it’s easy to find where 3[sup]n[/sup] = 2[sup]p[/sup] +1. An quick answer can be found with 3[sup]2[/sup] = 2[sup]3[/sup] + 1

My related question has to do with representing the 3[sup]n[/sup] value as a series of 2 to the power of some other numbers without coefficients. For example, I could write 3[sup]4[/sup]=81 as:

3[sup]4[/sup] = 81 = 2[sup]6[/sup] + 2[sup]4[/sup] + 2[sup]0[/sup] = 64 + 16 + 1

As a shorthand, I would say that 3[sup]4[/sup] could be represented by the sum of 2 to the powers of [6 4 0] and 3 terms are needed.

I also had my program print out the 2-to-the-power reduction for the various 3[sup]n[/sup]. One thing that surprised me was that there was limited number of terms required regardless of the value of n. To represent the numbers for 3[sup]n[/sup], where n are the integers from 20 to 647, the maximum number of terms needed was about 38. That surprises me because to represent a number like 2[sup]p[/sup] - 1 requires p terms. For example:

2[sup]5[/sup] - 1 = 31 = 2[sup]4[/sup] + 2[sup]3[/sup] + 2[sup]2[/sup] + 2[sup]1[/sup] + 2[sup]0[/sup] = 16 + 8 + 4 + 2 + 1

However, 3[sup]626[/sup] only requires 20 terms:

3[sup]626[/sup] = 2[sup]992[/sup] + 2[sup]989[/sup] + 2[sup]985[/sup] + 2[sup]984[/sup] + 2[sup]982[/sup] + 2[sup]980[/sup] + 2[sup]978[/sup] + 2[sup]976[/sup] + 2[sup]974[/sup] + 2[sup]968[/sup] + 2[sup]966[/sup] + 2[sup]959[/sup] + 2[sup]957[/sup] + 2[sup]956[/sup] + 2[sup]953[/sup] + 2[sup]949[/sup] + 2[sup]946[/sup] + 2[sup]945[/sup] + 2[sup]942[/sup] + 2[sup]0[/sup]

So my related question is this: Is there a maximum number of 2-to-the-power-of terms which can represent any 3[sup]p[/sup] number where, p is an integer from 1->infinity?

Yes, 3[sup]1[/sup] = 2[sup]2[/sup] -1
You note 3[sup]2[/sup] = 2[sup]3[/sup] +1. Also 3[sup]1[/sup] = 2[sup]1[/sup] +1 :smiley:
But these simple cases exhaust the adjacent powers of two or three. Proof of this fact is among the mathematical gems of Rabbi Levi ben Gershon (1288-1344).

You may need a new calculater! (i’ll guess yours doesn’t handle large numbers.) The LHS and RHS are very close, but unequal.
The number of powers of 2 that sum to any number is simply the number of 1’s in that number’s binary representation which, for 3[sup]626[/sup], is about 473 I think.

Wow, that’s amazing, especially given when the Rabbi lived.

Levi ben Gershon (aka Gersonides) plays a large role as a fictional character in one of my favourite popular novels, Iain Pears’ The Dream of Scipio. (In that novel, much like his other Instance of the Fingerpost, he includes a great many real-life historical figures as characters). I didn’t know he was a mathematician, though the book portrays him as a kind of all-around polymathic scolar.

Well, any positive integer can be represented as the sum of various powers of 2 without coefficients. That is nothing more than the binary system, or numbers written in base-2.

And yes, the maximum number of terms you would ever need to represent a number up to 2[sup]n[/sup]-1, for some n, is log[sub]2/sub, or simply n. Thus, for example, to represent 2[sup]321[/sup]-1 requires all 321 terms.