cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A182334 Triangular numbers that differ from a square by 1.

Original entry on oeis.org

0, 1, 3, 10, 15, 120, 325, 528, 4095, 11026, 17955, 139128, 374545, 609960, 4726275, 12723490, 20720703, 160554240, 432224101, 703893960, 5454117903, 14682895930, 23911673955, 185279454480, 498786237505, 812293020528, 6294047334435, 16944049179226
Offset: 1

Views

Author

Arkadiusz Wesolowski, Apr 25 2012

Keywords

Comments

From Robert G. Wilson v, Jun 20 2015: (Start)
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.
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.
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.
(End)

Examples

			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.
		

References

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

Crossrefs

Subsequence of A000217 and of A087279.

Programs

  • 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
    
  • Mathematica
    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 *)
    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 *)
    #(# + 1)/2 & /@ Join[{0, 1}, LinearRecurrence[{1, 0, 6, -6, 0, -1, 1}, {2, 4, 5, 15, 25, 32, 90}, 35]] (* or *)
    #(# + 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 *)
    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 *)
    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 *)
  • 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

Formula

a(n) = 35*a(n-3) - 35*a(n-6) + a(n-9). - Charles R Greathouse IV, Apr 25 2012
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