Lyapunov Characteristic Number

Clear["Global`*"]

r=3.1;
x0=0.1;
f[x_]= r x (1-x);
fd[x_]=D[f[x],x];
Nmax=100;
Print["r=",r]
lsum=0;
lcn={};
For[i=1,i≤Nmax,i++,lsum=lsum+Log[Abs[fd[x0]]];x0=f[x0];AppendTo[lcn,N[(lsum/i)]]]
ListPlot[lcn,Joined->True,AxesLabel->{"N","λ"}, PlotRange->{-1,1}]
Print["LCN after N=",Nmax," iterations,  λ=",lcn[[Length[lcn]]]]