login
A276599
Values of n such that n^2 + 5 is a triangular number (A000217).
5
1, 4, 10, 25, 59, 146, 344, 851, 2005, 4960, 11686, 28909, 68111, 168494, 396980, 982055, 2313769, 5723836, 13485634, 33360961, 78600035, 194441930, 458114576, 1133290619, 2670087421, 6605301784, 15562409950, 38498520085, 90704372279, 224385818726
OFFSET
1,2
FORMULA
a(n) = 6*a(n-2) - a(n-4) for n>4.
G.f.: x*(1+x)*(1+3*x+x^2) / ((1+2*x-x^2)*(1-2*x-x^2)).
a(n) = (1/4)*(P(n+2) + P(n+1) + (-1)^n*(3*P(n) - 7*P(n-1))), where P(n) = A000129(n). - G. C. Greubel, Sep 15 2021
EXAMPLE
4 is in the sequence because 4^2 + 5 = 21, which is a triangular number.
MATHEMATICA
CoefficientList[Series[(1+x)*(1+3*x+x^2)/((1+2*x-x^2)*(1-2*x-x^2)), {x, 0, 30}], x] (* Wesley Ivan Hurt, Sep 07 2016 *)
LinearRecurrence[{0, 6, 0, -1}, {1, 4, 10, 25}, 30] (* Harvey P. Dale, Feb 13 2017 *)
PROG
(PARI) Vec(x*(1+x)*(1+3*x+x^2)/((1+2*x-x^2)*(1-2*x-x^2)) + O(x^40))
(PARI) a(n)=([0, 1; -1, 6]^(n\2)*if(n%2, [1; 10], [-1; 4]))[1, 1] \\ Charles R Greathouse IV, Sep 07 2016
(Magma) I:=[1, 4, 10, 25]; [n le 4 select I[n] else 6*Self(n-2) - Self(n-4): n in [1..31]]; // G. C. Greubel, Sep 15 2021
(Sage)
def P(n): return lucas_number1(n, 2, -1)
[(1/4)*(P(n+2) + P(n+1) + (-1)^n*(3*P(n) - 7*P(n-1))) for n in (1..30)] # G. C. Greubel, Sep 15 2021
CROSSREFS
Cf. A001109 (k=0), A106328 (k=1), A077241 (k=2), A276598 (k=3), A276600 (k=6), A276601 (k=9), A276602 (k=10), where k is the value added to n^2.
Sequence in context: A159297 A248731 A279101 * A281867 A298806 A362179
KEYWORD
nonn,easy
AUTHOR
Colin Barker, Sep 07 2016
STATUS
approved