function y=frank2(m,p),  %mod p
n=max(m);
if nargin==1, p=n; end
y=zeros(1,n+1); y(1)=2; y(2)=1;
y=mod(y,p);
for k=3:(n+1)
  y(k)=mod(y(k-2)+y(k-1),p);
end
y=y(m+1);
