# 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?

The code will not run! Fix $a$ to go from 1 to 100 or 1000, etc. Set up b and c based on the rules stated above. Compute $D$, then $\sqrt{D}$ (use math.sqrt(..)) and see what you get. Dismiss.
Show a friend, family member, or teacher what you've done!