## Saturday, September 12, 2020

Solution Exercise 85: python algorithm that determines all tuples of integers verifying a given equation

#### Exercise 85

Write an algorithm in Python which determines the list of all pairs of relative integers (x, y) verifying the equation : xy - x - y = n for a given integer n. give the result for n = 19.

#### Solution

``````def solutionsEq(n):
# Initialize list of solutions
listSolution = []
for x in range(-n , n + 1):
for y in range(-n , n + 1):
if x*y - x - y == 19:
listSolution.append((x,y))
return listSolution
# Testing algorithm
print("List of solutions tuples is : " , solutionsEq(19))
``````
The output is:
List of solutions tuples is : [(-19, 0), (-9, -1), (-4, -3), (-3, -4), (-1, -9), (0, -19), (2, 21), (3, 11), (5, 6), (6, 5), (11, 3), (21, 2)]

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 