dat=TableClearAll[f,g,floorTerm,kMax,a];f[n_]:=x*3^n+Sum[3^(n-1-j)*a[j],{j,0,n-1}];g[n_]:=(2f[n]-1+2^(k+1))2^(k+2);g2[n_]:=(2f[n]-1+2^(k+2))2^(k+3);floorTerm[n_]:=(Floor[g[n]]-Floor[g2[n]]-Floor[f[n]/2^(k+2)]);kMax[n_]:=Floor@Log@f[n];a[0]=1;a[n_]:=a[n]=2(f[n]-Sum[2^kfloorTerm[n],{k,0,kMax[n]}]);(*lookatlimitingbehaviorofratioofa[n]tox*5^n(n=10isalreadygoodenoughforlookingatthelimit)*)x,N@(*changestepsizeof10^4belowto10^6ifyouwanttojustgetaquickplot*),{x,1,10^9,10^4};(*lookslikea[n]isalmostproportionalto5^nforlargenandanyx,althoughtheremightbeanadditionalsub-logarithmicgrowthtermastheratioisslowlygrowing*)ListPlotdat,Joined->True,Frame->True,FrameLabel->"x","[n]"
a[10]
6*x
-1+10
5
lim
n->∞
a
x
6x*
n-1
5
Out[]=
In[]:=
(*let'ssmooththedatawithMovingAveragetoremovethehighfrequencyosicallitions*)ts=TemporalData[dat];smoothed=MovingAverage[ts,100];(*itlooksliketheratioisapproaching1,soa[n]~6x*forlargexandn*)ListLinePlotsmoothed,Frame->True,FrameLabel->"x","[n]",PlotRange->All
(n-1)
5
lim
n->∞
a
x
6x*
n-1
5
Out[]=