Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [diophantine-equations]

Questions on the use of Mathematica to find integer/rational solutions to equations.

4
votes
1answer
859 views
2
votes
4answers
175 views

FrobeniusSolve with solutions only being 0 or 1 being acceptable

I want an EFFICIENT way of solving the Frobenius Equation a1 n1 + a2 n2 + a3 n3 + ... + aK nK = U where n1, n2, ..., nK are restricted to be either 0 or 1. I ...
3
votes
4answers
162 views

How do I declare a countably infinite list of variables as being integers?

I want to do this, Solve[ { n1 + n2 + n3 + .... = 10, n1 + 2 n2 + 3 n3 + .... = 100}, {n1,n2,n3,....}, Assumptions -> {n1,n2,n3,.... are Integers >=0} ] ...
2
votes
2answers
114 views

On the solvability of the Diophantine equation $a(x^2-y^2)+2bxy=1$

Take two integers $a,b$ with $\mathrm{GCD}(a,b)=1$ and $a$ odd. Consider the Diophantine equation $$ a(x^2-y^2)+2bxy=1,\qquad x,y\in\mathbb Z $$ Is there any efficient way to determine whether such ...
0
votes
1answer
84 views

Unexpected omission by Wolfram Alpha [closed]

When Alpha is submitted the equation $a(a^2-1)=2b^2$, it unexpectedly forgets the integer solution $a=1,b=0$. What could explain this ? http://www.wolframalpha.com/input/?i=a(a%5E2-1)%3D2b%5E2
4
votes
2answers
728 views

How can I reduce the time to run this code?

I am trying to find the integers $ a, b, c, d \in [-15, -1] \cup [1, 15] $ so that the equation $ \left| x^2 + a x + b \right| = c x + d $ has four distinct integeral solutions different from $ 0 $. ...
3
votes
1answer
92 views

Guess Diophantine equation from its solutions

Take for example the equation $$ n^2=x^2+y^2+1 $$ where $x,y$ are integers. This equation admits solutions only for some values of $n$, to wit, $$ n=1,3,9,17,19,33,35,51,73,81,99,\dots $$ Can we ...
0
votes
0answers
43 views

When can FindInstance prove no solutions for a nonlinear Diophantine equation?

A few months ago, I thought of a marvelous proof that $a^3+b^3=2c^3$ has no nontrivial integer solutions in $\mathbb{N}$, but the margin of my cocktail napkin was too small to contain it. Now I've ...
1
vote
1answer
78 views

How do we show reduction steps?

This produces 3 equivalent Diophantine equations. How can we show the reduction steps? I need to do this for a paper. ...
4
votes
3answers
239 views

Finding Smallest Positive Solution to Diophantine Equation

Mathematica can solve $v^2- d u^2=4$ quickly, even for nonsmall $d$: d = 400004; Reduce[v^2 - d u^2 == 4, Integers] d = 400012; Reduce[v^2 - d u^2 == 4, Integers] ...
3
votes
3answers
638 views

Solving a system of diophantine equations from a mathematical competition

There is a problem from the $66th$ Putnam Mathematical Competition, $B2$ Find all positive integers $n,k_1,k_2,...,k_n$ such that $$k_1+\cdots+k_n=5n-4$$ and $$\frac{1}{k_1}+\cdots+\frac{1}{...
-3
votes
2answers
300 views

Solving a diophantine equation with three variables

Solve this equation using Mathematica: $2^x + 113^y = z^2$, $\operatorname{gcd}(x, y) = 1$.
6
votes
2answers
137 views

Unexpected behaviour with FindInstance

Evaluating FindInstance[a/(b + c) + b/(a + c) + c/(a + b) == 4, {a, b, c}, Integers] does what I'd expect it to do: find a solution to the equation in integers. ...
2
votes
1answer
112 views

Storing Multiple solutions from Solve as rows of a matrix

I am trying to find all the solutions to a Diophantine equation (only integer valued solutions) using Solve[], however there are multiple and even many solutions sometimes. How can I store these ...
5
votes
1answer
365 views

Solving a Diophantine equation with a large solution

I am trying to solve the following Diophantine equation with Mathematica: $\frac{x}{y+z}+\frac{z}{x+y}+\frac{y}{x+z}=4$ It is known that there are three positive numbers that satisfy the equation ...
2
votes
0answers
57 views

Introducing constraints in FrobeniusSolve

I have a knapsack problem. Say I have N possible items $x_i$. I would like to know: $ \sum_{i=0}^{2} c_i x_i = W$ With the following constraint: $c_i=3 \lor 4$ As an example suppose the set $x_i=...
2
votes
0answers
113 views

How to test solvability of a Diophantine equation?

When applying the BRC theorem I need to test if an equation has a non-zero solution in integers. The equation is of form: $$x^2 + by^2 + cz^2 = 0$$ We could try to directly check if this equation ...
2
votes
2answers
215 views

Integer partitions without repetitions

What combination of numbers makes a specific sum? The code below is not very effective, because it also gives answers in which a number is used more than once even though it was given in the list ...
5
votes
2answers
118 views

Finding all solutions in the Roth's theorem

Roth's theorem. For all algebraic irrational $\alpha$ $$\displaystyle \left \lvert \alpha - \frac{p}{q} \right \rvert < \frac{1}{q^{2 + \epsilon}}$$ with $\epsilon>0$, has finitely many ...
16
votes
5answers
2k views

Puzzle — 20 People to consume 20 units of food under constraints

I am learning Mathematica because I love it. I also love solving puzzles so I think it would be a nice way to learn Mathematica through puzzles. This is first puzzle in series I intend to solve. So ...
0
votes
1answer
246 views

Solving Diophantine equations

Given a complex number $z$ and a positive integer $n$, I would like to be able to find integer solutions $\alpha,\beta,\gamma$ to the Diophantine equation $$0 < a^2\vert z \vert^2 + \beta\textrm{ ...
4
votes
3answers
163 views

find and count the number of solutions without multiplicity in Solve?

I would like to solve a Diophantine equation and find its solution, but I need only count one time for each $a$, i.e., when for some $a$ it found some $x,y,z$, then go to the next $a$. more precisely ...
2
votes
2answers
231 views

Solve an exponential equation in integers

Find two integers x and y such that $x^y +y^x = 94032$. I have used ...
20
votes
3answers
815 views

Partitioning a number into consecutive integers

Consider n=45; then $$1+2+3+4+5+6+7+8+9=45$$ $$5+6+7+8+9+10=45$$ $$7+8+9+10+11=45$$ $$14+15+16=45$$ $$22+23=45$$ Question: how to find all representations of a ...
1
vote
0answers
83 views

diophantine linear equation with condition on the sum of coefficients [closed]

I am trying to solve the following diophantine equation x*a + y*b == c where a,b,c are integers and the absolute value of their sums is, for instance, 4. Then I ...
2
votes
2answers
233 views

how to find sum of variable c1+c2+c3 for expression combinations

how to find sum of variable c1 + c2 + c3 for expression combinations: ...
5
votes
3answers
178 views

On Solutions of Diophantine Equation

By Mathematica, I try to obtain solutions of Diophantine equations such as: $$F_{n_1}F_{n_2}\cdots F_{n_k}+1=F_t$$ where the sequence $\{F_n\}$ is the Fibonacci sequence,$n_1 < n_2 < \cdots &...
6
votes
1answer
115 views

Find out whether solutions exist rather than full-blown solution search

I have some quadratics, and I am trying to find out whether there exist solutions in the integers. The following tells me that the first does, wheraeas the second doesn't: ...
3
votes
4answers
1k views

How to merge permutations obtained from Solve on multiple variables?

When I compute the following expression to find integer solutions of the equation (x^2 + y^2 + z^2 == 14^2) ...
3
votes
2answers
268 views

Diophantine equation: getting a list of solutions for each coeficient

I'm trying to solve the following diophantine equation,$$x^3+dy^3=1$$ such that $$x,y \in \mathbb{Z} \land y \neq 0$$ and I want to form a list of solutions for each $$d\in[1,1000]; d\in\mathbb{N}$$ ...
5
votes
2answers
223 views

Optimization problems over the Integers

Should be an easy question. How can I define a function which gets only integers in a form that I can use to find max and min for instance? Example: Find the Max of the expression ...
4
votes
0answers
227 views

Solving Thue equations

A Thue equation is a 2-variable homogeneous integer polynomial of degree at least 3. It's well-known that such equations have only finitely many solutions over the integers. I'm trying to solve some ...
-1
votes
1answer
87 views

equidistant solutions in Sequence Sums That Are Squares

In my demonstration "Sequence Sums That Are Squares" I demonstrate two "lines" of solutions (of infinite length) and ask whether someone can find one more line. I am looking forward to your solution. ...
2
votes
2answers
138 views

Problem on Consecutive Sequence Sums that are Squares

Here is a seemingly simple Problem: I have two natural numbers n and m, n < m such that S1:= n +...+ m is a square and also S2:= n +...+ m + (m+1) is a square. Problem a) : Find n and m. You ...
2
votes
4answers
3k views

find the number of integral solutions a+b+c+d+e+f = 18 [duplicate]

Find the number of integral solutions of a + b + c + d + e + f = 18 where a, b, c, d, e, f are elements of the range ...
10
votes
2answers
390 views

Efficient way to solve equal sums $x_1^k+x_2^k+\dots+x_5^k=y_1^k+y_2^k+\dots+y_5^k$ with Mathematica?

I need to solve the system of equations, call it $S_1$, in the integers $$x_1x_2x_3x_4x_5 = y_1y_2y_3y_4y_5$$ $$x_1^k+x_2^k+\dots+x_5^k=y_1^k+y_2^k+\dots+y_5^k,\;\; k= 2,4,6$$ I used a very ...
6
votes
1answer
2k views

How to solve this equation with integers as a solution?

I want to solve the equation $$x^y + y = y^x + x$$ with $x$, $y$ are integer numbers. I tried Solve[x^y + y == y^x + x, {x, y}, Integers] How to solve the ...
6
votes
3answers
272 views

How do I generate a set of n-tuples containing integral solutions to a linear equation provided certain constraints?

Let $m,k,p$ be fixed positive integers. I want to create a table of k-tuples $(x_1,x_2,\ldots,x_k)$ comprised of solutions in positive integers to the equation below: $$x_1+x_2+\cdots+x_k=m\quad\...
5
votes
2answers
939 views

Extracting Reduce results

I'm solving a Diophantine equation inside of a function using Reduce but I'm having trouble extracting the necessary parts of the answer. For example, if my input ...
7
votes
0answers
457 views

Computing Ehrhart's polynomial for a convex polytope

Is there a Mathematica implementation for computing the Ehrhart polynomial of a convex polytope which is specified either by its vertices or by a set of inequalities? I am interested in knowing this ...
14
votes
6answers
5k views

How to find lattice points on a line segment?

How do I find points on the line segment joining {-4, 11} and {16, -1} whose coordinates are positive integers?
10
votes
2answers
1k views

Solving/Reducing equations in $\mathbb{Z}/p\mathbb{Z}$

I was trying to find all the numbers $n$ for which $2^n=n\mod 10^k$ using Mathematica. My first try: Reduce[2^n == n, n, Modulus -> 100] However, I receive ...
14
votes
2answers
624 views

Is there a way to use functions like Prime[n] within Solve[]?

I'm trying to see if a number can be written as the sum of two prime numbers. Ideally, I would like to use Solve[ Prime[n] + Prime[m] == 100, {n, m}] But that ...
3
votes
1answer
2k views

How to solve this equation with positive integers as a solutions?

This is a problem of United Kingdom Mathematical Olympiad. Find all triples $(x,y,z)$ of positive integers such that $$\biggl(1+\dfrac{1}{x}\biggr)\cdot \biggl(1+\dfrac{1}{y}\biggr)\cdot \biggl(1+\...
1
vote
1answer
976 views

Using 'Reduce' to solve a set of inequalities, specified by a list

I have a two lists $LHS$ and $RHS$, both of size $n$. I want to solve a system of inequalities of the form: $$LHS[1] \leq RHS[1]$$ $$LHS[2] \leq RHS[2]$$ $$LHS[3] \leq RHS[3]$$ $$\vdots$$ $$LHS[n]...
9
votes
3answers
3k views

Finding the number of solutions to a diophantine equation

I want to count total number of the natural solutions (different from 0) of the equation $2x + 3y + z = 100$, but don't know how. How can I calculate it using Mathematica? I tried: ...
8
votes
3answers
3k views

How can I solve the equation with integers as a solution?

I want to solve the equation $$(x-1)^2 + (y-1)^2 + (z-1)^2 = 49$$ where $x$, $y$, $z$ are integer and $x \neq 1$, $y \neq 1$, $x \neq 1$. How do I tell Mathematica to do that?
8
votes
4answers
720 views

Defining a Unique Domain for Solving Diophantine Equations

I am working on a research problem in discrete geometry to do with sphere packings, and believe it or not, I have been able to reduce it to finding the solutions to the Diophantine equation, $$n = \...
11
votes
3answers
582 views

FindInstance with a Diophantine equation seems to go on forever

I tried to find a non-trivial integer solution to the equation $$2012^2=a^2+b^2+c^2+d^2+e^2$$ with Mathematica but the computation takes minutes; I might be doing something wrong. ...