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}$.

Type your code here:

See your results here:

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.
Does your code work? Want to run it on your iPhone?

Here's your code:

- Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
- Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
this page
- Then click the "Use on iPhone" button that you'll see.