OFFSET
1,4
COMMENTS
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..1000
EXAMPLE
First ten rows:
0
1 0
2 1 0
3 2 1 0
3 2 1 2 0
4 3 2 3 1 0
4 3 2 1 3 4 0
5 4 3 2 4 5 1 0
4 3 2 3 1 2 4 5 0
5 4 3 5 2 3 6 7 1 0
d(6,4) = 3 counts the edges in the path 6,3,2,4;
d(46,21) = 6 counts the edges in the path 46,23,22,11,10,20,21.
MATHEMATICA
f[{x_, y_}] := f[x, y] = If[EvenQ[x], {y, x/2}, {x - 1, y}];
g[{x_, y_}] := g[x, y] = Drop[FixedPointList[f, {x, y}], -1];
s[n_] := s[n] = Reverse[Select[Sort[Flatten[Select[g[{n, 0}], #[[2]] == 0 &]]], # > 0 &]];
m[h_, k_] := m[h, k] = Max[Intersection[s[h], s[k]]];
j[h_, k_] := j[h, k] = Join[Select[s[h], # >= m[h, k] &], Reverse[Select[s[k], # > m[h, k] &]]];
d[h_, k_] := d[h, k] = If[k*h == 0, Length[j[h, k]], -1 + Length[j[h, k]]];
TableForm[Table[d[h, k], {h, 0, 59}, {k, 0, 59}]]; (* A257570 array *)
Flatten[Table[d[h - k, k], {h, 0, 59}, {k, 0, h}]]; (* A257570 sequence *)
CROSSREFS
KEYWORD
AUTHOR
Clark Kimberling, May 01 2015
STATUS
approved