%I #22 Sep 08 2022 08:45:29
%S 0,1,3,5,9,17,33,65,129,257,513,1025,2049,4097,8193,16385,32769,65537,
%T 131073,262145,524289,1048577,2097153,4194305,8388609,16777217,
%U 33554433,67108865,134217729,268435457,536870913,1073741825,2147483649
%N Smallest m such that A008687(m) = n.
%C A008687(a(n)) = n and A008687(m) < n for m < a(n).
%H Vincenzo Librandi, <a href="/A127904/b127904.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2).
%F For n>1, a(n) = A000051(n-1) = 2^(n-1)+1.
%F From _Bruno Berselli_, Sep 01 2011: (Start)
%F G.f.: x*(1-2*x^2)/((1-x)*(1-2*x)).
%F a(n) = 3*a(n-1) -2*a(n-2) for n=2 and n>3. (End)
%t Join[{0,1},LinearRecurrence[{3,-2},{3,5},40]] (* or *) Join[{0,1},2^Range[ 40]+1] (* _Harvey P. Dale_, Jan 16 2013 *)
%o (PARI) x='x+O('x^30); concat([0], Vec(x*(1-2*x^2)/((1-x)*(1-2*x)))) \\ _G. C. Greubel_, Apr 30 2018
%o (PARI) a(n) = if(n<2,n,2^(n-1)+1); \\ _Altug Alkan_, May 01 2018
%o (Magma) m:=30; R<x>:=PowerSeriesRing(Rationals(), m); [0] cat Coefficients(R!(x*(1-2*x^2)/((1-x)*(1-2*x)))); // _G. C. Greubel_, Apr 30 2018
%K nonn,easy
%O 0,3
%A _Reinhard Zumkeller_, Feb 05 2007