  We compute exactly the distribution of the occupation time in a discrete {\em
non-Markovian} toy sequence which appears in various physical contexts such as
the diffusion processes and Ising spin glass chains. The non-Markovian property
makes the results nontrivial even for this toy sequence. The distribution is
shown to have non-Gaussian tails characterized by a nontrivial large deviation
function which is computed explicitly. An exact mapping of this sequence to an
Ising spin glass chain via a gauge transformation raises an interesting new
question for a generic finite sized spin glass model: at a given temperature,
what is the distribution (over disorder) of the thermally averaged number of
spins that are aligned to their local fields? We show that this distribution
remains nontrivial even at infinite temperature and can be computed explicitly
in few cases such as in the Sherrington-Kirkpatrick model with Gaussian
disorder.
