Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #24 Apr 10 2020 15:15:12
%S 1,2,3,4,7,10,15,24,34,52,82,116,180,280,396,616
%N Maximal value of A270655 between indices 3^n and 3^(n+1).
%p A270655:= proc(n) option remember;
%p local k;
%p k:= n mod 3;
%p if k = 0 then procname(n/3) elif k=1 then procname((n-1)/3)+procname((n+2)/3)
%p else procname((n+1)/3)-procname((n-2)/3)
%p fi
%p end proc:
%p A270655(0):= 0: A270655(1):= 1:
%p seq(max(map(A270655,[$3^n .. 3^(n+1)])),n=0..15); # _Robert Israel_, Nov 12 2018
%t 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]];
%t a[n_] := Module[{m = 1}, For[i = 3^n, i <= 3^(n + 1), i++, m = Max[m, b[i]] ]; Print[n, " ", m]; m];
%t a /@ Range[0, 15] (* _Jean-François Alcover_, Apr 10 2020 *)
%o (PARI) \\ here b(n) is A270655.
%o 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))))}
%o a(n)={my(m=1); for(i=3^n, 3^(n+1), m=max(m, b(i))); m} \\ _Andrew Howroyd_, Nov 11 2018
%Y Cf. A270655.
%K nonn,more
%O 0,2
%A _Max Barrentine_, Mar 20 2016
%E Offset corrected and a(12)-a(13) from _Andrew Howroyd_, Nov 11 2018
%E a(14)-a(15) from _Robert Israel_, Nov 12 2018