Lesson goal: What kind of numbers will result?

Previous: An even more clever for-loop for Pi | Home | Next: Diverging and converging series

Suppose $D=a^2+b^2+c^2$, where $a$ and $b$ are consecutive integers and $c=ab$. What type of result do you think $\sqrt{D}$ will be? (From Salkind, 1967.)

A. always an even integer
B. sometimes an odd integer, sometimes not
C. always an odd integer
D. sometimes rational, sometimes not
E. always irrational


Write some code to cycle through 100 or 1000 different numbers and see if you can spot a pattern in the result of $\sqrt{D}$.

Now you try. What do think about $\sqrt{D}$? Choice A, B, C, D, or E?

Type your code here:


See your results here: