Assuming that you are looking for numbers 1, 2, 4, 8..., or in other words, 2^0, 2^1, 2^2, 2^3, ..., then a solution that is deterministic could be:
two_power_n(s(X)) :-
two_power_n_minus_one(X).
two_power_n_minus_one(0).
two_power_n_minus_one(s(X)) :-
half(s(s(X)), s(Y)),
two_power_n_minus_one(Y).
half(0, 0).
half(s(s(X)), s(Y)) :-
half(X, Y).
I don't think this solution is optimal.