1
$\begingroup$

I am trying to find integer solutions for a set of equations and would appreciate any help or insights on methods to determine if solutions exist for certain cases or generally. The equations are as follows:

  1. For the case where $\frac{3^n - 1}{2}$ is odd:

$$ x = \frac{\left(\frac{3^n - 1}{2}\right) - 2^y}{2 \times \left(3^{n-1} - 2^y\right)} $$

and

$$ y = \log_2\left(\frac{3^{n-1} \cdot x + \left(\frac{3^n - 1}{2}\right)}{2 \cdot x + 1}\right) $$

  1. For the case where $\frac{3^n - 1}{2}$ is even:

$$ y = \log_2\left(\frac{3^{n-1} \cdot x + \frac{3^n - 1}{4}}{2 \cdot x + 1}\right) $$

where $x$, $y$, and $n$ must all be integers. Edit : $n > 1$. and $y \neq (n-1) \cdot \log(3)$ and $x > 1$.

I have attempted to programmatically search for solutions by iterating over a range of values for $n$ and $y$, but I am unsure if this approach is coherent, especially without knowing a priori whether solutions exist. Some intermediate calculations suggest the possibility of solutions under specific conditions, but a comprehensive method to confirm their existence or to find solutions systematically is not clear to me.

Can anyone provide guidance on how to approach solving these equations for integer solutions, or suggest methods that might reveal whether solutions exist for particular cases or more generally? Any advice on tackling this problem or insights into the underlying mathematics would be greatly appreciated.

Thank you in advance for your help!

Here is my python code also :

from sympy import log, primerange

def check_new_y_equation(solutions, max_m):
    """
    Checks if the given solutions satisfy the equation where (3**n - 1)/2 is odd.
    """
    valid_solutions = []
    
    for x, y, n in solutions:
        # Calculate the new y using the given equation for the odd case
        numerator = 3**(n-1) * x + (3**n - 1)/2
        denominator = 2 * x + 1
        # Assuming the result is a power of 2, so m must be an integer
        potential_y = log(numerator/denominator, 2)
        
        # Check if potential_y is an integer by testing different values of m
        for m in range(1, max_m + 1):
            if potential_y == m:
                valid_solutions.append((x, n, m))
                break  # Found a valid solution, no need to test other values of m

    return valid_solutions

def check_new_y_equation2(solutions, max_m):
    """
    Checks if the given solutions satisfy the equation where (3**n - 1)/2 is even.
    """
    valid_solutions = []
    
    for x, y, n in solutions:
        # Calculate the new y using the given equation for the even case
        numerator = 3**(n-1) * x + (3**n - 1)/4
        denominator = 2 * x + 1
        # Assuming the result is a power of 2, so m must be an integer
        potential_y = log(numerator/denominator, 2)
        
        # Check if potential_y is an integer by testing different values of m
        for m in range(1, max_m + 1):
            if potential_y == m:
                valid_solutions.append((x, n, m))
                break  # Found a valid solution, no need to test other values of m

    return valid_solutions

def check_integer_solutions(max_search):
    """
    Searches for integer solutions of x, y, and n within the specified range.
    """
    solutions = []

    for n in range(1, max_search):
        for y in range(1, max_search):
            # Calculate parts of the equation
            num = (3**n - 1) // 2 - 2**y
            den = 3**(n-1) - 2**y

            # Check if the numerator is divisible by the denominator
            if num % den == 0:
                # If so, then x is an integer and we add the solution
                x = num // den
                if ((3**n - 1)/2) % 2 == 0:
                    solz = check_new_y_equation2([(x, y, n)], max_search)
                else:
                    solz = check_new_y_equation([(x, y, n)], max_search)
                if len(solz) > 0:
                    solutions.append((x, y, n))
                    print(f"sol{x},{y},{n}")

    return solutions

# Test the function for a reasonable range of values for n and y
solutions_found = check_integer_solutions(1000)
solutions_found

$\endgroup$

1 Answer 1

1
$\begingroup$

I will solve the first equation for integer $x,y,n \ge 0$.

The condition ($\frac{3^n - 1}{2}$ is odd) means that $3^n-1\underset{4}\equiv 2$. Or $3^n\underset{4}\equiv 3$. So $n$ must be odd.

Now consider the equation: $$ x = \frac{\left(\frac{3^n - 1}{2}\right) - 2^y}{2 \times \left(3^{n-1} - 2^y\right)} $$

It can be rewritten as: $$4x(3^{n-1}-2^y)=3^n-1-2^{y+1}.$$

Then as: $$4x\cdot 3^{n-1}-2x\cdot 2^{y+1}=3\cdot 3^{n-1}-1-2^{y+1}.$$

And then as: $$(2x-1)\cdot 2^{y+1}=(4x-3)\cdot 3^{n-1}+1.$$

Let us consider the last equation modulo $4$. The right hand side is $(-3)\cdot 1+1 \underset{4}\equiv 2$ (remember that $n$ is odd). Now the left hand side. If $y>0$ then it is divisible by $4$. So $y=0$. Then the equation becomes:

$$4x-2=(4x-3)\cdot 3^{n-1}+1.$$

Or $$4x-3=(4x-3)\cdot 3^{n-1}.$$

Since $4x-3\neq 0$ we see that $x$ can be any number and $n=1$.

Thus, the answer to your first equation is $$x\text{ is any non-negative integer}, y=0, n= 1.$$

$\endgroup$
1
  • $\begingroup$ Thanks, in fact this is a solution. As you see in my program i'm looking for solution where n>1 $\endgroup$
    – fabul.io
    Feb 16 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .