function fnbase4=flipbase4(nbase4)
digits = size(nbase4,2);
fnbase4 = nbase4;
for k = 1:digits
 if nbase4(k)==1 || nbase4(k)==2
  for j = 1:k-1
   fnbase4(j) = 3 - fnbase4(j);
  end
 end
end

