%I #14 Apr 05 2017 03:40:13
%S 3,1,4,5,35,10,8,26,15,38,20,13,55,78,27,70,68,53,36,282,44,73,75,69,
%T 64,34,32,585,51,30,139,165,72,121,535,97,83,253,67,469,168,61,147,
%U 146,59,93,123,286,815,1398,112,294,119,129,347,138,124,81,144,194,256,142
%N Least inverse of A005210.
%C It seems likely that every number eventually appears in A005210, so this sequence is probably well-defined. - _N. J. A. Sloane_, Apr 16 2015
%D Popular Computing (Calabasas, CA), Z-Sequences, Vol. 4 (No. 42, Sep 1976), pp. 12-16.
%H Alois P. Heinz, <a href="/A051203/b051203.txt">Table of n, a(n) for n = 0..20000</a>
%H Popular Computing (Calabasas, CA), <a href="/A005210/a005210.pdf">Z-Sequences, continued.</a> Annotated and scanned copy of pages 14, 15, 16, 18 of Vol. 5 (No. 56, Nov 1977).
%p b:= proc(n) option remember;
%p `if`(n<3, 1, abs(b(n-1)+2*b(n-2)-n))
%p end:
%p a:= proc() local t, a; t, a:= 0, proc() -1 end;
%p proc(n) local h;
%p while a(n) = -1 do
%p t:= t+1; h:= b(t);
%p if a(h) = -1 then a(h):= t fi
%p od; a(n)
%p end
%p end():
%p seq(a(n), n=0..100); # _Alois P. Heinz_, Apr 16 2015
%t nMax = 100; bMax = 2000;
%t b[n_] := b[n] = If[n < 3, 1, Abs[b[n-1] + 2*b[n-2] - n]];
%t a[n_] := (For[k = 1, k <= bMax, k++, If[b[k] == n, Return[k]]]; -1);
%t Table[a[n], {n, 0, nMax}] (* _Jean-François Alcover_, Apr 05 2017 *)
%Y Cf. A005210.
%K nonn
%O 0,1
%A _David W. Wilson_
|