Calculating Number of Permutations in 2D Barcode I want to calculate all possible combinations of a 2d barcode with 8 lines: 2d barcode with 8 lines.
Each line can be either present (1) or not (0):
My approach is:

*

*Total number of objects (n) = 8

*Number of elements taken (r) = 2

*Repetitions are allowed

$$ 8^2 = 64$$
Am I correct?

You're not exactly right. For each bar, you can either choose $0$ or $1$. Since there are $8$ bars, you have $\underset{8 \text{ times}}{\underbrace{2 \times 2 \times 2 \times ... \times 2}}=2^8$ possibilities.
In general, the number of functions from $[|1,n|]$ to $[|1,k|]$ is $k^n$ (and not $n^k$)
