This paper considers the problem of computing a Lyapunov function for nonlinear discrete-time systems. The proposed solution is systematic and consists of two steps. First, a pseudo-Lyapunov function, called finite-step Lyapunov function, is computed by solving a finite dimensional nonlinear optimization problem. Then, a recent converse theorem is employed, which gives an explicit construction of a Lyapunov function from a finite-step Lyapunov function. This procedure produces additionally an invariant set, through a nonlinear optimization program. An example illustrates the developed procedure and gives insight into the problem complexity.