# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
79 lines (75 sloc) 6.04 KB
 Counting 2
randRange( 3, 5 ) randRange( 20, 50 ) randRange( 7, 15 ) START + ( NTH - 1 ) * INCR

person( 1 ) starts counting at START, and he counts by cardinalThrough20( INCR )s.

person( 1 ) starts counting at START, and she counts by cardinalThrough20( INCR )s.

If START is the 1st number that person( 1 ) counts. what is the NTHth number that he counts?

If START is the 1st number that person( 1 ) counts. what is the NTHth number that she counts?

What is the first number that he counts?

What is the first number that she counts?

START

What is the second number that he counts?

What is the second number that she counts?

\begin{align*}&START + INCR \\ &= START + INCR\end{align*}

What is the third number that he counts?

What is the third number that she counts?

\begin{align*}&START + INCR + INCR \\ &= START + (2 \times INCR) \\ &= START + 2 * INCR\end{align*}

What is the NTHth number that he counts?

What is the NTHth number that she counts?

\begin{align*}&START + (NTH - 1\timesINCR) \\ &= START + ( NTH - 1 ) * INCR \\ &= ANSWER\end{align*}

randRange( 5, 10 ) ( NUM * ( NUM - 1 ) ) / 2

There are NUM people in a room.

If everyone shakes everyone else's hand exactly once, how many handshakes occur?

Given NUM people, each person shakes the hands of NUM - 1 other people.

The following is almost the answer.

NUM \times NUM - 1 = NUM * ( NUM - 1 )

We have double counted the handshakes though, since person( 1 ) shaking person( 2 )'s hand is the same handshake as person( 2 ) shaking person( 1 )'s hand.

Therefore, the following is the correct answer.

\dfrac{NUM \times NUM - 1}{2} = ANSWER

randRangeUnique( 2, 6, 2 ) NUM_COLORS * NUM_POTS

person( 1 ) wants to give his friend a potted plant. At the local florist, the flowers come in NUM_COLORS colors, and there are NUM_POTS types of flower pots.

person( 1 ) wants to give her friend a potted plant. At the local florist, the flowers come in NUM_COLORS colors, and there are NUM_POTS types of flower pots.

If he can choose any flower and any pot, how many different potted plants can person( 1 ) buy?

If she can choose any flower and any pot, how many different potted plants can person( 1 ) buy?