[Nov 1, 2020 Programming Adventures]

In[]:=
f[n_]:=f[n-1]+f[n-2]
In[]:=
f[1]=f[2]=1
Out[]=
1
In[]:=
Array[f,20]
Out[]=
{1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765}
In[]:=
f[n_]:=f[n]=f[f[n-1]]+f[n-f[n-1]]
In[]:=
Array[f,20]
Out[]=
{1,1,2,2,3,4,4,4,5,6,7,7,8,8,8,8,9,10,11,12}
In[]:=
Table[f[n]-n/2,{n,200}]
Out[]=

1
2
,0,
1
2
,0,
1
2
,1,
1
2
,0,
1
2
,1,
3
2
,1,
3
2
,1,
1
2
,0,
1
2
,1,
3
2
,2,
3
2
,2,
5
2
,2,
5
2
,2,
3
2
,2,
3
2
,1,
1
2
,0,
1
2
,1,
3
2
,2,
5
2
,2,
5
2
,3,
7
2
,3,
7
2
,4,
7
2
,4,
7
2
,3,
7
2
,4,
7
2
,4,
7
2
,3,
7
2
,3,
5
2
,2,
5
2
,2,
3
2
,1,
1
2
,0,
1
2
,1,
3
2
,2,
5
2
,3,
5
2
,3,
7
2
,4,
9
2
,4,
9
2
,5,
11
2
,5,
11
2
,6,
11
2
,6,
11
2
,5,
11
2
,6,
13
2
,6,
13
2
,7,
13
2
,7,
13
2
,6,
13
2
,7,
13
2
,7,
13
2
,6,
13
2
,6,
11
2
,5,
11
2
,6,
11
2
,6,
11
2
,5,
11
2
,5,
9
2
,4,
9
2
,4,
7
2
,3,
5
2
,3,
5
2
,2,
3
2
,1,
1
2
,0,
1
2
,1,
3
2
,2,
5
2
,3,
7
2
,3,
7
2
,4,
9
2
,5,
11
2
,5,
11
2
,6,
13
2
,7,
13
2
,7,
15
2
,8,
15
2
,8,
17
2
,8,
17
2
,8,
15
2
,8,
17
2
,9,
19
2
,9,
19
2
,10,
21
2
,10,
21
2
,11,
21
2
,11,
21
2
,10,
21
2
,11,
23
2
,11,
23
2
,12,
23
2
,12,
23
2
,11,
23
2
,12,
23
2
,12,
23
2
,11,
23
2
,11,
21
2
,10,
21
2
,11,
23
2
,11,
23
2
,12,
23
2
,12
In[]:=
ListLinePlot[%]
Out[]=
50
100
150
200
2
4
6
8
10
12
In[]:=
Clear[f]
In[]:=
f[n_]:=f[n]=f[n-f[n-1]]+f[n-f[n-2]]
In[]:=
f[1]=f[2]=1;
In[]:=
ListLinePlot[Table[f[n]-n/2,{n,200}],PlotRangeAll]
Out[]=
50
100
150
200
-20
-10
10
20
30
In[]:=
ListLinePlot[Table[f[n]-n/2,{n,1000}],PlotRangeAll]
Out[]=
200
400
600
800
1000
-100
-50
50
100
In[]:=
Histogram[Table[f[n]-n/2,{n,1000}],{1}]
Out[]=
-30
-20
-10
0
10
20
30
40
0
20
40
60
80
In[]:=
ListLinePlot[FoldList[Max,Table[f[n]-n/2,{n,1000}]],PlotRangeAll]
Out[]=
200
400
600
800
1000
20
40
60
80
100
120
In[]:=
ListLinePlot[FoldList[Max,Table[f[n]-n/2,{n,10000}]],PlotRangeAll]
Out[]=
2000
4000
6000
8000
10000
100
200
300
400
500
600
In[]:=
Histogram[Table[f[n]-n/2,{n,10000}],{1}]
Out[]=
-300
-200
-100
0
100
200
300
0
50
100
150
In[]:=
Table[{n-f[n-1],n-f[n-2]},{n,3,10}]
Out[]=
{{2,2},{2,3},{2,3},{3,3},{3,4},{3,4},{4,4},{4,5}}
In[]:=
ListLinePlot[Transpose[Table[{n-f[n-1],n-f[n-2]},{n,3,100}]]]
Out[]=
20
40
60
80
100
10
20
30
40
50
60
Number of possible paths to the leaves from a given point is the Fibonacci number...

Weird function

Another case