OFFSET
0,2
MAPLE
A270655:= proc(n) option remember;
local k;
k:= n mod 3;
if k = 0 then procname(n/3) elif k=1 then procname((n-1)/3)+procname((n+2)/3)
else procname((n+1)/3)-procname((n-2)/3)
fi
end proc:
seq(max(map(A270655, [$3^n .. 3^(n+1)])), n=0..15); # Robert Israel, Nov 12 2018
MATHEMATICA
b[0] = 0; b[1] = 1; b[n_] := b[n] = Switch[Mod[n, 3], 0, b[n/3], 1, b[3((n - 1)/3 + 1)] + b[n - 1], 2, b[3((n - 2)/3 + 1)] - b[n - 2]];
a[n_] := Module[{m = 1}, For[i = 3^n, i <= 3^(n + 1), i++, m = Max[m, b[i]] ]; Print[n, " ", m]; m];
a /@ Range[0, 15] (* Jean-François Alcover, Apr 10 2020 *)
PROG
(PARI) \\ here b(n) is A270655.
b(n)={if(n<2, n, my(r=n%3, q=n\3); if(r==0, b(q), if(r==1, b(q) + b(q+1), b(q+1) - b(q))))}
a(n)={my(m=1); for(i=3^n, 3^(n+1), m=max(m, b(i))); m} \\ Andrew Howroyd, Nov 11 2018
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Max Barrentine, Mar 20 2016
EXTENSIONS
Offset corrected and a(12)-a(13) from Andrew Howroyd, Nov 11 2018
a(14)-a(15) from Robert Israel, Nov 12 2018
STATUS
approved