>>931をヒントの再帰版ばぃ

f[n_, l_: {}] :=
If[n == 0, Rest[l],
f[Quotient[n + 1, 3], Prepend[l, Mod[n + 1, 3] - 1]]]

f[25]
{0, -1, 1}

どや?