function fn=flip(digits, n)
nbase4 = base4(digits,n);
fnbase4 = flipbase4(nbase4);
fn = base4val(fnbase4);

