Periodic solutions of hamiltonian equations