Questions tagged [diophantine]
48 questions
0
votes
1 answer
Python code to find the integer solutions of multivariable cubic equation (Diophantine equation)?
My equation is a multivariable cubic equation, and I want to find its integer solutions in a given interval x = range(-10,11). The equation is
a3 + b3 + c3 + d3 + e3 - (a + b + c + d + e)3 = 0
Is the following code correct?
from itertools import…

epsilon
- 1
- 1
0
votes
0 answers
Why does the SymPy diophantine module occasionally return a solution for an expression in some symbols, but not for the same expression in others?
Having imported the following:
from sympy.solvers.diophantine.diophantine import diop_ternary_quadratic
from sympy.abc import x,y,z,d,h,c
Running the code diop_ternary_quadratic(-7938*x**2+14436*x*y-98*y**2-z**2) returns (761, 441, 15120), however…

Benjamin Vakil
- 1
- 2
0
votes
0 answers
Calculating Third Divisor on a HyperElliptic Curve in a Finite Field
I have been working on a program that Calculates the third divisor, D3, on a HyperElliptic curve given D1 and D2 in a FINITE FIELD. I have taken many approaches and have decided on using Cantors Algorithm to do so.
In order to use Cantors Algorithm,…

Jordan De Sotle
- 3
- 1
- 5
0
votes
0 answers
Fastest way to solve non-negative linear diophantine equations
Let A be a list of n lists of m non-negative integers, such that for all j there is i with A[i][j] nonzero. Let V be a list of m positive integers.
Question: What is the fastest way to find all the lists X of n non-negative integers such that for…

Sebastien Palcoux
- 131
- 10
0
votes
2 answers
I want sympy gcdex(ax + by = c This is a linear Diophantine equation.)
I want to cal
https://en.wikipedia.org/wiki/Diophantine_equation#Examples
ax + by = c This is a linear Diophantine equation.
i try
I think the way you substituted h is not good.
How should I fix it?
x,y…

mrrclb46z
- 89
- 6
0
votes
2 answers
Solving a Diophantine
I was given the task to solve the graded Diophantine problem. McDonald’s sells Chicken McNuggets in packages of 6, 9 or 20 McNuggets. Thus, it is possible, for example, to buy exactly 15 McNuggets (with one package of 6 and one package of 9), but…

Interpreter
- 7
- 4
0
votes
1 answer
Diophantine Equation
that takes a number (n) as an argument and returns tuple of four numbers which are; total number of packages, the number of packages of 6 nuggets, the number of packages of 9 nuggets and the number of packages of 20 nuggets that are needed to sell n…

Interpreter
- 7
- 4
0
votes
1 answer
How can we solve a system of quadratic diophantine equations efficiently unsing Python?
I am investigating/evaluating technical ways to solve quadratic diophantine systems of equations. My concrete problem can be boiled down into the following two steps:
Loading a Textfile that contains lines of tuples [sqrt(s), sqrt(t), sqrt(u), s,…

Eldar Sultanow
- 205
- 2
- 9
0
votes
1 answer
Why the program does not correctly search for the general solution of the Diophantine equation
I wrote a program that looks for a general solution to a Diophantine equation, but the solution is not entirely correct when I check the online calculator. For example, for the equation "45x-128y=177" the solution in general form should be…

aspcartman111
- 11
- 1
0
votes
1 answer
Function for Diophantine equations of form x^2 - N * y^2 = 1
The problem that I'm having is in properly executing the 'chakravala' method in Python. It runs properly up until n = 181. I've tried to integrate the composition method into my function, but run into a decimal.Overflow almost instantly.
The string…

Matthew Shidner
- 13
- 3
0
votes
1 answer
Linear Diophantine equation, Extended Euclidean Algorithm
suppose i want to find any value of x and y such that they satisfy x . W + y . D = P
this can be done by the following using extended euclidean algorithm
int exgcd(int a, int b, int &x, int &y)
{
if (b == 0)
{
x = 1;
y = 0;
…

keemahs
- 780
- 11
- 14
0
votes
1 answer
Is there a sage module to solve equation such as ax+by=c?
Is there a module in Sage to solve 2 unknowns in diophantine equations?
For instance, ax+by=c where a,b,c are known
I tried basic extended euclidean algorithm but my numbers are too large.

Stefan
- 11
- 1
- 6
0
votes
1 answer
tkinter listbox: adding lines to listbox 1-by-1 through a function
I have a program that takes user input in the form of an integer, lets call it k. Three other numbers are known, a,b and c. My task is to find all positive integer solutions {x,y,z} such that
ax + by + cz = k. I wrote a method that I call on…

Tom Richter
- 1
- 1
0
votes
3 answers
How to check if number is integer number, with good precision?
There is similar question: Checking whether a variable is an integer or not,
but I see no answer to my question.
I mean, I was fighting with big numbers recently, so friend of mine suggested me to install Python. I opened it today, so that I can…

Kusavil
- 294
- 6
- 15
0
votes
2 answers
project euler 454 diophantine recipricols
The question is:
In the following equation x, y, and n are positive integers.
1/x + 1/y = 1/n
For a limit L we define F(L) as the number of solutions which satisfy x < y ≤ L.
We can verify that F(15) = 4 and F(1000) = 1069.
Find F(1012).
I decided…

hahahakebab
- 328
- 7
- 22