function [per]=period(amax)
%period.m-This file will test different values for a coefficient in a
%congruential random number generator and determine the period for that
%value

b=0;
m=8192;
x0=1;
t=1:amax;

for a=1: amax
    
    y(1)=mod(a*x0,m);
    
    for i=2: 8192
        
        y(i)=mod(a*y(i-1),m);
        
        if y(i)==0, per(a)=0, break,end;
            
        if y(i)==y(1),per(a)=i-1,break,end;
               
    end
end

plot(t,per,'*');
title('Periodicity of Period for CRN');xlabel('a');ylabel('period');

