  We derive for Ising spins an off-equilibrium generalization of the
fluctuation dissipation theorem, which is formally identical to the one
previously obtained for soft spins with Langevin dynamics [L.F.Cugliandolo,
J.Kurchan and G.Parisi, J.Phys.I France \textbf{4}, 1641 (1994)]. The result is
quite general and holds both for dynamics with conserved and non conserved
order parameter. On the basis of this fluctuation dissipation relation, we
construct an efficient numerical algorithm for the computation of the linear
response function without imposing the perturbing field, which is alternative
to those of Chatelain [J.Phys. A \textbf{36}, 10739 (2003)] and Ricci-Tersenghi
[Phys.Rev.E {\bf 68}, 065104(R) (2003)]. As applications of the new algorithm,
we present very accurate data for the linear response function of the Ising
chain, with conserved and non conserved order parameter dynamics, finding that
in both cases the structure is the same with a very simple physical
interpretation. We also compute the integrated response function of the two
dimensional Ising model, confirming that it obeys scaling $\chi (t,t_w)\simeq
t_w^{-a}f(t/t_w)$, with $a =0.26\pm 0.01$, as previously found with a different
method.
