# publicKhan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Fetching contributors…

Cannot retrieve contributors at this time

file 78 lines (75 sloc) 6.189 kb
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78         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?

If person( 1 ) decided on a flower color, how many different potted plant combinations are there?

He can choose one of NUM_POTS flower pots, and so there are NUM_POTS different potted plants possible (given that he already chose a flower color).

She can choose one of NUM_POTS flower pots, and so there are NUM_POTS different potted plants possible (given that she already chose a flower color).

Since there are NUM_COLORS flower colors, there are NUM_COLORS \times NUM_POTS = ANSWER possible potted plants.

Something went wrong with that request. Please try again.