function[vec] = base3(x)
j=1;
a=1;
for k = 1:100
a = floor(3^(k)*x);
if mod(a,3) == 2
  vec(1,j) = 1;
  vec(2,j) = k;
  vec(1,j+1)= 1;
  vec(2,j+1) = k;
  j=j+2;

elseif mod(a,3) == 1
   vec(1,j) = 1;
   vec(2,j) = k;
   j = j+1;

else vec(1,j)=0;
   vec(2,j) = k;
   j=j+1;
end
end   
  
   