2

question is find total number of sequence of digits $9$ with digits from set $[0,1,2]$ which either begins or end with $210$

  1. digits begin with 210 are $3^6$
  2. digit end with $210$ are $3^6$
  3. in both cases there is extra counting of same nunbers likw 210 _ _ _ 210 which are $3^3$ so i have to subtract from 1 and 2 above

somehow answer does not match

help thanks

Gathdi
  • 1,402

2 Answers2

2

Assuming leading zeros are allowed:

The count of numbers that begin or end in $210$ is equal to the total count of numbers minus those that do not begin or end in $210$ at all. There are $3^9$ total strings, ignoring restrictions.

There are $3^3 - 1 = 26$ ways to have three digits at the start that exclude $210$, and similarly for the last three digits as well. Then there are $3^3 = 27$ ways to freely allocate the three digits in the middle.

So the answer is $3^9 - 26 \cdot 27 \cdot 26 = 1431$.

1

Subtract from 1 and 2? But you haven't overcounted twice. You've counted once, and then overcounted once.

law-of-fives
  • 1,963
  • in Q it says it should begin with 210 or end with 210 – Gathdi May 05 '17 at 00:54
  • Quite so. You counted all the right numbers in (1). Then you counted all the numbers in (2), but unfortunately overcounted the numbers in (3) which were already correctly counted in (1). So you should add (1)+(2)-(3). – law-of-fives May 05 '17 at 01:10
  • but 2 and 1 cases have same numbers – Gathdi May 05 '17 at 03:01