Decide the total amount of six digit numbers which don't contain the sequence. The following problem. 
I have to decide how many numbers that satisfy the following 
It should not contain the sequence 17 eg. 1743, 4179. 
A leading zero does not count as a digit. 0234 is not a four digit number.
My approach was to get all the numbers and then subtract all numbers with 17.
All numbers - Bad numbers
Bad numbers. 
17.... = $10^4$
.17... = $8\cdot 10^3$
..17.. = $8\cdot 10^3$
...17. = $8\cdot 10^3$
....17 = $8\cdot 10^3$
Then i tried to remove duplicates. 
Example. Last row contains elements from row 1 - 3. 
But it results in bad answer!
 A: Here    is   a   very    simple   solution    that   does    not   use
inclusion-exclusion.  The  setup  is  the  same  as  in  the  previous
answer.  Suppose  the forbidden  two-letter  pattern  consists of  two
different letters.
Introduce  the  sequence $\{a_n\}$  that  counts  all  strings of  $n$
letters without the forbidden pattern  that end in the first letter of
the  pattern  and  the   sequence  $\{b_n\}$  that  counts  admissible
sequences that do not end   in said letter. The  quantity  $$a_n+b_n$$
gives the value we are looking for.
Then  we  have  $a_0  =  0$  and  $b_0 =  1$  and  the  following  two
recurrences:
$$a_n = a_{n-1} + b_{n-1}
\quad\text{and}\quad
b_n = (q-2) a_{n-1} + (q-1) b_{n-1}.$$
This is because an admissible sequence on $n$ letters that ends in the first letter call it $P$ of the pattern can be obtained from a sequence on $n-1$ letters of the same type by appending $P$ (recall that we said the two letters in the pattern are different) or by taking a sequence that does not end in $P$ and appending $P$. On the other hand an admissible sequence on $n$ letters that does not end in $P$ can be obtained from those that end in $P$ by appending any letter but $P$ and $Q$, where $Q$ is the second letter of the pattern or appending any letter but $P$ to a sequence on $n-1$ letters that does not end in $P.$ 
Introducing the two generating functions
$$A(z) = \sum_{n\ge 0} a_n z^n
\quad\text{and}\quad
B(z) = \sum_{n\ge 0} a_n z^n$$
and multiplying by $z^n$ and summing over $n\ge 1$ we obtain the two
equations 
$$\sum_{n\ge 1} a_n z^n = 
z \sum_{n\ge 1} a_{n-1} z^{n-1} +  z \sum_{n\ge 1} b_{n-1} z^{n-1}$$
and
$$\sum_{n\ge 1} b_n z^n = 
(q-2) z \sum_{n\ge 1} a_{n-1} z^{n-1} + (q-1) z \sum_{n\ge 1} b_{n-1} z^{n-1} $$
or alternatively (using the intial values)
$$A(z) - 0 = z A(z) + z B(z)
\quad\text{and}\quad
B(z) - 1 = (q-2) z A(z) + (q-1) z B(z).$$
Solving these we find that
$$A(z) = \frac{z}{1-qz+z^2}
\quad\text{and}\quad
B(z) = \frac{1-z}{1-qz+z^2}.$$
Now  the  generating function  $f(z)$  of  all  sequences without  the
forbidden pattern is
$$f(z) = A(z) + B(z) = \frac{1}{1-qz+z^2}$$
the same as we obtained earlier and we may continue on as before.
Observation. This generating function does not take into account that there may not be any leading zeros. To get that value, take the difference between consecutive values as shown in the other answer.
