OFFSET
1,2
COMMENTS
Not currently known to be finite for all n.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..200
MAPLE
b:= proc(n) option remember; local i, t, ok;
if n<2 then n
else for t from 1 +b(n-1) do ok:=true;
for i to n/2 while ok
do ok:= b(n-2*i)+t <> 2*b(n-i) od;
if ok then return t fi
od
fi
end:
a:= proc() local t, a; t, a:= 0, proc() 0 end;
proc(n) local h;
while a(n) = 0 do
t:= t+1; h:= b(t) -b(t-1);
if a(h) = 0 then a(h):= t fi
od; a(n)
end
end():
seq(a(n), n=1..30); # Alois P. Heinz, May 26 2014
MATHEMATICA
nmaxb = 2000; (* max index of b(n) *)
nmaxa = 30; (* max index of a(n) *)
b[n_] := b[n] = Module[{i, t, ok}, If[n < 2, n, For[t = 1 + b[n - 1], True, t++, ok = True; For[i = 1, i <= n/2 && ok, i++, ok = b[n - 2 i] + t != 2 b[n - i]]; If[ok, Return[t]]]]];
B = Array[b, nmaxb] // Differences;
a[n_] := a[n] = Module[{p = FirstPosition[B, n]}, Which[n == 1, 1, p === Missing["NotFound"], -1, True, p[[1]] + 1]];
Array[a, nmaxa] (* Jean-François Alcover, Nov 23 2020, after Alois P. Heinz for b(n) *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, May 26 2014
STATUS
approved