Z = \f. (\x. f (\v. x x v)) (\x. f (\v. x x v)) can be much simpler, namely
S (S (K (S S (K (S (S K K) (S K K))))) K) (S (K (S S (K (S (S K K) (S K K))))) K)
var Z = S(S(K(S(S)(K(S(S(K)(K))(S(K)(K))))))(K))(S(K(S(S)(K(S(S(K)(K))(S(K)(K))))))(K));
Unfortunately not works with the `count_fn` function from the wikipedia page :(, `too much recursion`.