login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Triangular numbers that differ from a square by 1.
4

%I #41 Sep 08 2022 08:45:55

%S 0,1,3,10,15,120,325,528,4095,11026,17955,139128,374545,609960,

%T 4726275,12723490,20720703,160554240,432224101,703893960,5454117903,

%U 14682895930,23911673955,185279454480,498786237505,812293020528,6294047334435,16944049179226

%N Triangular numbers that differ from a square by 1.

%C From _Robert G. Wilson v_, Jun 20 2015: (Start)

%C Actually this sequence is the union of two subsequences; the triangular numbers that are less than a square by 1 and those that are greater than a square by 1.

%C The first sequence by index of the triangular numbers is A072221: b(n) = 6b(n-1) - b(n-2) + 2, with b(0)=1, b(1)=4.

%C And obviously the second sequence by index of the triangular numbers is A006451: c(n) = 6c(n-2) - c(n-4) + 2 with c(0)=0, c(1)=2, c(2)=5, c(3)=15.

%C (End)

%D Edward J. Barbeau, Pell's Equation (Springer 2003) at 17.

%H Harvey P. Dale, <a href="/A182334/b182334.txt">Table of n, a(n) for n = 1..1000</a>

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

%F a(n) = 35*a(n-3) - 35*a(n-6) + a(n-9). - _Charles R Greathouse IV_, Apr 25 2012

%F G.f.: x^2*(1+3*x+10*x^2-20*x^3+15*x^4-25*x^5+38*x^6+x^8-x^9) / ((1-x)*(1+x+x^2)*(1-34*x^3+x^6)). - _Colin Barker_, Sep 17 2016

%e T(2) = 3 = 2^2 - 1, T(4) = 10 = 3^2 + 1, T(5) = 15 = 4^2 - 1, and T(15) = 120 = 11^2 - 1.

%t lst = {}; Do[t = n*(n + 1)/2; If[IntegerQ[(t - 1)^(1/2)] || IntegerQ[(t + 1)^(1/2)], AppendTo[lst, t]], {n, 0, 10^4}]; lst (* _Arkadiusz Wesolowski_, Aug 06 2012 *)

%t b[n_] := b[n] = 6 b[n - 1] - b[n - 2] + 2; b[0] = 1; b[1] = 4; c[n_] := c[n] = 6 c[n - 2] - c[n - 4] + 2; c[0] = 0; c[1] = 2; c[2] = 5; c[3] = 15; #(# + 1)/2 & /@ Union@ Join[ Array[b, 9, 0], Array[c, 18, 0]] (* or *)

%t #(# + 1)/2 & /@ Join[{0, 1}, LinearRecurrence[{1, 0, 6, -6, 0, -1, 1}, {2, 4, 5, 15, 25, 32, 90}, 35]] (* or *)

%t #(# + 1)/2 & /@ CoefficientList[ Series[x + x^2 (1 + x) (2 + x^2 - 3 x^3 + x^4)/((1 - x) (1 - 6 x^3 + x^6)), {x, 0, 36}], x] (* _Robert G. Wilson v_, Jun 20 2015 *)

%t a[n_] := a[n] = 35 a[n - 3] - 35 a[n - 6] + a[n - 9]; a[1] = 0; a[2] = 1; a[3] = 3; a[4] = 10; a[5] = 15; a[6] = 120; a[7] = 325; a[8] = 528; a[9] = 4095; a[10] = 11026; a[11] = 17955; Array[a, 36] (* _Robert G. Wilson v_ after _Charles R Greathouse IV_, Apr 25 2012 *)

%t Select[Accumulate[Range[0,6*10^6]],AnyTrue[Sqrt[#+{1,-1}],IntegerQ]&] (* or *) LinearRecurrence[{0,0,35,0,0,-35,0,0,1},{0,1,3,10,15,120,325,528,4095,11026,17955},40] (* The first program uses the AnyTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Dec 24 2015 *)

%o (Magma) I:=[0,1,3,10,15,120,325,528,4095,11026,17955]; [n le 11 select I[n] else 35*Self(n-3)-35*Self(n-6)+Self(n-9): n in [1..30]]; // _Vincenzo Librandi_, Jun 21 2015

%o (PARI) concat(0, Vec(x^2*(1+3*x+10*x^2-20*x^3+15*x^4-25*x^5+38*x^6+x^8-x^9)/((1-x)*(1+x+x^2)*(1-34*x^3+x^6)) + O(x^30))) \\ _Colin Barker_, Sep 17 2016

%Y Subsequence of A000217 and of A087279.

%Y Cf. A001110, A006451, A072221, A229131, A299921.

%K nonn,easy

%O 1,3

%A _Arkadiusz Wesolowski_, Apr 25 2012