login
Triangular numbers of the form k^2 + k + 1.
6

%I #39 Jun 05 2022 23:21:27

%S 1,3,21,91,703,3081,23871,104653,810901,3555111,27546753,120769111,

%T 935778691,4102594653,31788928731,139367449081,1079887798153,

%U 4734390674091,36684396208461,160829915470003,1246189583289511,5463482735306001,42333761435634903

%N Triangular numbers of the form k^2 + k + 1.

%H G. C. Greubel, <a href="/A069017/b069017.txt">Table of n, a(n) for n = 1..1001</a>

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

%F G.f.: (x^4 + 2*x^3 - 16*x^2 + 2*x + 1)/((1 - x)*(1 - 6*x + x^2)*(1 + 6*x + x^2)).

%F From _Zak Seidov_, Sep 25 2010: (Start)

%F a(n) = 34*a(n-2) - a(n-4) - 11.

%F a(n) = 2*A124174(n) + 1. (End)

%F a(n) = (A077443(n)^2 - 1)/2. - _Amiram Eldar_, Dec 01 2018

%t Do[a = n(n + 1) + 1; b = Floor[Sqrt[2a]]; If[b(b + 1) == 2a, Print[a]], {n, 1, 106}] (* _Robert G. Wilson v_ *)

%t Select[Table[n^2+n+1,{n,0,206*10^6}],OddQ[Sqrt[8#+1]]&] (* The program takes a long time to run. *) (* _Harvey P. Dale_, Sep 22 2017 *)

%t CoefficientList[Series[(x^4 +2*x^3 -16*x^2 +2*x +1)/((1-x)*(1-6*x+x^2)*(1+6*x+x^2)), {x,0,50}], x] (* _G. C. Greubel_, Dec 01 2018 *)

%o (PARI) Vec((x^4+2*x^3-16*x^2+2*x+1)/((1-x)*(1-6*x+x^2)*(1+6*x+x^2)) +O(x^66)) /* _Joerg Arndt_, Mar 25 2013 */

%o (Magma) m:=50; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!( (x^4 +2*x^3 -16*x^2 +2*x +1)/((1-x)*(1-6*x+x^2)*(1+6*x+x^2)) )); // _G. C. Greubel_, Dec 01 2018

%o (Sage) s=((x^4 +2*x^3 -16*x^2 +2*x +1)/((1-x)*(1-6*x+x^2)*(1+6*x+x^2))).series(x, 50); s.coefficients(x, sparse=False) # _G. C. Greubel_, Dec 01 2018

%Y Cf. A124174.

%K nonn,easy

%O 1,2

%A _Amarnath Murthy_, Apr 02 2002

%E Program and terms from _Robert G. Wilson v_

%E a(18)-a(22) from _Alex Ratushnyak_, Mar 23 2013