Obtain all combinations of 3 numbers with repetition. I'm stuck with this problem and I'd like to get some help. I think there is something I'm not aware of. So, the thing is I'm given this control matrix H. 
      0000111111111
H =   0111000111222
      1012012012012

I'm asked to obtain all the words of this code. The theory of linear and block codes says that a word V is that word which H*Vt=0 (zero) where Vt is transposed V.
Now the fun part is I have to implement it using Pari GP
At the moment I do know there are 3^10 = 59049 possible words. That is the size of the matrix which is obtained by powering the body qin this case q=3 of the matrix to the dimension which is columns-rows.
My problem is I dont know how to generate all the vectors (words) so H*Vt = 0. That should be somethins like 
[0,0,0,0,0,0,0,0,0,0,0,0,0]
[0,0,0,0,0,0,0,0,0,0,0,0,1] 
[0,0,0,0,0,0,0,0,0,0,0,1,0]
.... 
[1,1,1,1,1,1,1,1,1,1,1,1,1]
...
[2,2,2,2,2,2,2,2,2,2,2,2,2]

Am I correct in my thinking or there is soming I'm missing or misunderstanding? How could I generate all the vector V that I need. 
At the moment I tried the numtoperm()%3 function but that is not a good solution because there are being mixed 10 numbers converted to modulo 3 while I only need 0,1 and 2 to be mixed.
Thank you so much!
 A: Suppose that the length of your number is $n$.  Then, you're asking to generate all trinary numbers with at most $n$ digits.  Since there are three digits, there are $3^n$ such numbers.
To get the sequences you're looking for, you must look at the trinary numbers from $0$ to $3^n-1$.  For a general number $k$, you can construct the trinary representation in the following way:
The units digit is $k\pmod 3$, the three's digit is $\lfloor k/3\rfloor\pmod 3$, and, in general, the digit in the $l$'s position is $\lfloor k/3^{l-1}\rfloor\pmod{3}$.
Here's some pseudo-code that does a calculation, but in the reverse order.  It computes all ternary numbers with less than or equal to $n$ ternary places (but the final number is written in base 10 (just using 0, 1, and 2).
 for(int i = 0; i < 3^n; i++)
 {
      k=0;
      l=i;
      for(int j = 1; j <= n; j++)
      {
           k = k * 10 + (l % 3); // Compute the next digit mod 3
           l = (l - (l % 3))/3; // Subtract the units digit and divide by 3
      }
      print k;
 }

Note that this computes the integer $k$ in the opposite order as described in the original discussion.
