clear all
s=20;
a=13;
b=1;
m=16;
p=0.5;
for I=1:m
       n=a*s+b;
u=mod(n,m);
v=u/m;
t1=log(v);
t2=log(1-p);
t3=t1/t2;
Geo=fix(t3)-1
s=u;
end
end