Generic two integer variable equation solver
This calculator can solve equations of the form ax² + bxy + cy² + dx + ey + f = 0 where the unknowns x and y are integer numbers.
You can type numbers or numerical expressions on the input boxes.
The calculator accepts numbers of up to 10000 digits, but notice that the algorithm requires the factorization of some numbers (in general large numbers cannot be factored in a reasonable amount of time). The factorization engine is the one used in the Elliptic Curve Method factorization applet, that uses the methods ECM and SIQS.
If there are too many solutions, the application could run out of memory. In this case it will not show anything.
Expressions
You can also enter expressions that use the following operators and parentheses:
- + for addition
- - for subtraction
- * for multiplication
- / for integer division
- % for modulus (remainder of the integer division)
- ^ or ** for exponentiation (the exponent must be greater than or equal to zero).
- <, ==, >; <=, >=, != for comparisons. The operators return zero for false and -1 for true.
- AND, OR, XOR, NOT for binary logic.
- SHL: Shift left the number of bits specified on the right operand.
- SHR: Shift right the number of bits specified on the right operand.
- n!: factorial (n must be greater than or equal to zero).
- p#: primorial (product of all primes less or equal than p).
- B(n): Previous probable prime before n
- F(n): Fibonacci number F_{n}
- L(n): Lucas number L_{n} = F_{n-1} + F_{n+1}
- N(n): Next probable prime after n
- P(n): Unrestricted Partition Number (number of decompositions of n into sums of integers without regard to order).
- Gcd(m,n): Greatest common divisor of these two integers.
- Modinv(m,n): inverse of m modulo n, only valid when gcd(m,n)=1.
- Modpow(m,n,r): finds m^{n} modulo r.
- Totient(n): finds the number of positive integers less than n which are relatively prime to n.
- IsPrime(n): returns zero if n is not probable prime, -1 if it is.
- NumDivs(n): Number of positive divisors of n either prime or composite.
- SumDivs(n): Sum of positive divisors of n either prime or composite.
- NumDigits(n,r): Number of digits of n in base r.
- SumDigits(n,r): Sum of digits of n in base r.
- RevDigits(n,r): finds the value obtained by writing backwards the digits of n in base r.
- ConcatFact(m,n): Concatenates the prime factors of n according to the mode expressed in m which follows this table:
ConcatFact function modes Mode Order of factors Repeated factors 0 Ascending No 1 Descending No 2 Ascending Yes 3 Descending Yes
You can use the prefix 0x for hexadecimal numbers, for example 0x38 is equal to 56.
The exponentiation symbol is not present in some mobile devices, so two asterisks ** can by typed as the exponentiation operator.
Source code
You can download the source of the current program and the old quadratic integer equation applet from GitHub. Notice that the source code is in C language and you need the Emscripten environment in order to generate Javascript.
Written by Dario Alpern. Last updated 10 August 2019.