# Ternary sequence

• Apr 30th 2007, 04:11 AM
smoothi963
Ternary sequence
A ternary sequence is a sequence of digits made up entirely of 0's, 1's, and 2's such as 002221102. (this is also known as a base three number)

A. How many 3-digit ternary sequences have exactly one 1?

B. How many 4-digit ternary sequences have exactly one 1?

C. How many 4-digit ternary sequences have exactly two 1?

D. How many n-digit ternary sequences have exactly k 1's (where n and k are non negative ints with k < n?

For a b and c my answers are

A. 12
B. 32
C. 12

I did it by hand but was wondering if there is another way to do this with equations? and i do not know how to do D. Can someone explain please.
• Apr 30th 2007, 04:41 AM
Soroban
Hello, smoothi963!

Quote:

A ternary sequence is a sequence of digits made up entirely
of 0's, 1's, and 2's such as 002221102. (this is also known as a base-three number)

A. How many 3-digit ternary sequences have exactly one 1?

We have a 3-digit number: ._ _ _

The "1" can be placed in any of the 3 slots.
The second digit must not be another 1; there are 2 choices.
The third digit also has 2 choices.

Hence, there are: .3 × 2² .= .12 three-digit numbers with one 1.

Quote:

B. How many 4-digit ternary sequences have exactly one 1?
We have a four-digit number: ._ _ _ _

The "1" can be placed in any of the 4 slots.
The second, third and fourth digits have 2 choices each.

Hence, there are: .4 × 2³ .= .32 four-digit numbers with one 1.

Quote:

C. How many 4-digit ternary sequences have exactly two 1's?
We have a four-digit number: ._ _ _ _

The two 1's can be placed in C(4,2) = 6 ways.
The other two digits have 2 choices each.

Hence, there are: .6 × 2² .= .24 four-digit numbers with two 1's.

Quote:

D. How many n-digit ternary sequences have exactly k 1's?
(where n and k are non negative integers with k < n)

Generalize what we did before . . .

We have an n-digit number: ._ _ _ . . . _

The k 1's can be placed in: .C(n,k) ways

Each of the other n-k digits have 2 choices each.
. . There are: .2^(n-k) ways

There are: .C(n,k)·2^(n-k) n-digit numbers with k 1's.
• Apr 30th 2007, 12:14 PM
smoothi963
Thank you:)