farey[0]=-2+(α/β)+(β/α)-z;
farey[1]=-2+α β+(1/(α β))+z;
farey[2]=(α β-(α/β)-(β/α)+(1/(α β)))z+z^2;
farey[n_]=4-(1/(α^2))+α^2+(1/(β^2))+β^2-farey[n-3]-farey[n-2] farey[n-1]/;EvenQ[n];
farey[n_]=2(α β+(α/β)+(β/α)+(1/(α β)))-farey[n-3]-farey[n-2] farey[n-1]/;OddQ[n];