login
a(0)=1, a(1)=2; for n > 1, a(n) = a(n - a(n-2)) + n.
1

%I #38 Jun 19 2021 11:52:39

%S 1,2,4,5,5,6,8,9,9,10,12,13,13,14,16,17,17,18,20,21,21,22,24,25,25,26,

%T 28,29,29,30,32,33,33,34,36,37,37,38,40,41,41,42,44,45,45,46,48,49,49,

%U 50,52,53,53,54,56,57,57,58,60,61,61,62,64,65,65,66,68,69,69,70

%N a(0)=1, a(1)=2; for n > 1, a(n) = a(n - a(n-2)) + n.

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,-2,2,-1).

%F a(n) = A130658(n) + n.

%F G.f.: (1 + 2*x^2 - x^3)/((1 - x)^2*(1 + x^2)). - _Stefano Spezia_, Feb 19 2021

%t A341744[n_] := Module[{a}, a[0] = 1; a[1] = 2; a[i_] := a[i] = a[i - a[i - 2]] + i; a[n]]; Table[A341744[n], {n, 0, 10}] (* _José María Grau Ribas_, Feb 18 2020, edited by _Robert P. P. McKone_, Feb 19 2021 *)

%t CoefficientList[Series[(1 + 2 x^2 - x^3)/((1 - x)^2*(1 + x^2)), {x, 0, 69}], x] (* _Michael De Vlieger_, Mar 19 2021 *)

%t LinearRecurrence[{2,-2,2,-1},{1,2,4,5},90] (* _Harvey P. Dale_, Jun 19 2021 *)

%Y Cf. A004001, A087836, A193358, A209869, A274213, A130658.

%K nonn,easy

%O 0,2

%A _José María Grau Ribas_, Feb 18 2021