Computer Program to Find All Quadratic Equations With Numerically Nice Answers

Metronome

Junior Member
Joined
Jun 12, 2018
Messages
134
I wrote a computer program to general all second order linear ODEs with constant integer coefficients between -19 and 19 that yield nice associated homogeneous solutions. This is really just the less fancy, algebraic problem of finding quadratic equations with nice numbers for the problem and solution. Here is my code: http://ideone.com/2yszmj

Here is the output: http://ideone.com/1Fhfaa I was extremely surprised to see how lopsided these three categories are. Apparently there are only eight non-trivial quadratic equations with integer coefficients between -19 and 19 that have a single answer. Is my code correct, or is there a bug leading to this result?
 
You really have to define nice numbers

x^2 has a single solution and the coefficients are all integers between -19 and 19
(x-1)^2 has a single solution and the coefficients are all integers between -19 and 19
(x-2)^2 has a single solution and the coefficients are all integers between -19 and 19
(x-3)^2 has a single solution and the coefficients are all integers between -19 and 19
(x-4)^2 has a single solution and the coefficients are all integers between -19 and 19
(x+1)^2 has a single solution and the coefficients are all integers between -19 and 19
(x+2)^2 has a single solution and the coefficients are all integers between -19 and 19
(x+3)^2 has a single solution and the coefficients are all integers between -19 and 19
(x+4)^2 has a single solution and the coefficients are all integers between -19 and 19

Why are you surprised? After all, the sqrt(19) is between 4 and 5.
 
Top