# Computing large nested values

Is it possible to compute a value for

n=10^9; Nest[# + Log[#] &, 2., n]


for large n? $10^9$ seems to be the max for me - is it possible to use previous results to compute piecewise, or any other workaround?

• Have you actually tried taking the output and feeding it back in? a = Nest[#+Log[#]&, 2., 10^9]; b = Nest[#+Log[#]&, a, 10^9] Because it sounds like Nest takes a 32 bit integer for the third argument. – N.J.Evans May 14 '15 at 17:56
• @martin glad to help! I've wasted entire days on things like this. :-/ – N.J.Evans May 14 '15 at 18:01
• Interestingly, this function has a series expansion around 1 which begins like the following : 1 + 2^n (x0-1) + (2^(n-2) - 4*4^(n-2)) (x0-1)^2 +... for initial value x0 and n the nesting depth. I'm still working on the higher order terms – Histograms May 14 '15 at 18:45
• @martin I can't seem to come up with a general formula for the cubic term :( but all the coefficients seem to always be divisible by a large power of 2, smaller than n. A remarkably interesting function! I was able to get the first two just by looking at the coefficients of Series[Nest[# + Log[#] &, x, n], {x, 1, 4}] for different n values. The second order term just happens to have a coefficient from this sequence. – Histograms May 14 '15 at 19:55
• @martin So I couldn't get any further with this and I suspect the coefficients have a very complex form, but I did make this somewhat irrelevant tweet sized fractal thing out of a similar related function log(x) - x : d=0.005;n=15;t=ParallelTable[If[NumericQ@#,Abs@#,0]&@Nest[(Log@#-#)&,x0+I y0,n],{x0,-1,1,d},{y0,-1,1,d}];ColorNegate@Image[Tanh[0.65*t]] I think I can see Satan in there somewhere. – Histograms May 21 '15 at 13:09

So it seems that Nest is limited to 32-bit integers for the 3rd argument. The way around this is to apply Nest to the result of the first ~2^32 Nests. Supplying his own function using Fold, @martin suggests
f[x_, r_] := Nest[# + Log[#] &, x, r];