clear all
s=20;
a=13;
b=1;
m=16;
p=0.5;
n=10;
for J=1:n
    Bi=0;
for I=1:m
       n=a*s+b;
u=mod(n,m);
v=u/m;
if v <= p
    B=1;
else 
    B=0;
end
Bi=Bi+B;
s=u;
end
Binomial(J)=Bi
s=exp(J);
end
Binomial=Binomial';
       save('D:\Practicas_simulacion_MatLab\Binomialresultados.txt','Binomial','-ascii');