function r=superstable(period,r,rold)
% finds r where there is a superstable period 2^n orbit the Logistic map
eps = 1.e-11;

yold = Logistic(period,rold,0.5)-0.5;
y = Logistic(period,r,0.5)-0.5;
while (abs(y)>eps)
    rn=r-(r-rold)*y/(y-yold);
    yold = y;
    rold = r;
    r = rn;
    y = Logistic(period,r,0.5)-0.5;
end