function v=pop(p)
% MCMC simulation of dying population, 
% probability p of survival.
pt = ones(10,10);
xpt = pt(:);
u = sum(xpt);
v = u;
while u > 0
    xpt = (rand(100,1)<=p*xpt);
    pt = reshape(xpt,10,10);
    u = sum(xpt);
    v = [v,u];
end
v;
