A099776 Length of the hypotenuse of an integer right triangle with the hypotenuse being one more than the longer side. The shorter sides are just consecutive odd numbers 3, 5, 7, ...
5, 13, 25, 41, 61, 85, 113, 145, 181, 221, 265, 313, 365, 421, 481, 545, 613, 685, 761, 841, 925, 1013, 1105, 1201, 1301, 1405, 1513, 1625, 1741, 1861, 1985, 2113, 2245, 2381, 2521, 2665, 2813, 2965, 3121, 3281, 3445, 3613, 3785, 3961, 4141, 4325, 4513
Offset: 1
Links
- Ray Chandler, Table of n, a(n) for n = 1..10000 (first 1000 terms from Vincenzo Librandi)
- M. Janjic and B. Petkovic, A Counting Function, arXiv 1301.4550 [math.CO], 2013.
- Index entries for linear recurrences with constant coefficients, signature (3,-3,1).
Programs
-
C
#include "stdio.h" int main(int argc, char* argv[]){ unsigned long i; int L = (argc>1) ? atol(argv[1]) : 50; for (i=(L>0) ? 1 : (L*=-1); i<=L; i++) printf ("%u, ", (i+1)*i*2+1); return 0; } // optional arg implemented by M. F. Hasler, Nov 03 2012
-
GAP
List([1..50], n-> n^2 +(n+1)^2); # G. C. Greubel, Sep 04 2019
-
Magma
[n eq 1 select 5 else Self(n-1)+4*n: n in [1..50]]; // Vincenzo Librandi, Mar 03 2013
-
Maple
seq(n^2 +(n+1)^2, n=1..50); # G. C. Greubel, Sep 04 2019
-
Mathematica
Table[n^2 +(n+1)^2, {n,50}] (* Vladimir Joseph Stephan Orlovsky, Sep 25 2009, modified by G. C. Greubel, Sep 04 2019 *) RecurrenceTable[{a[1]==5, a[n]==a[n-1] +4n}, a, {n, 50}] (* Vincenzo Librandi, Mar 03 2013 *) LinearRecurrence[{3,-3,1},{5,13,25},50] (* Harvey P. Dale, Jul 16 2018 *)
-
PARI
a(n)=1+2*n+2*n^2 \\ Charles R Greathouse IV, Oct 07 2015
-
Python
def A099776(n): return (n<<1)*(n+1)+1 # Chai Wah Wu, Oct 01 2024
-
Sage
[n^2 +(n+1)^2 for n in (1..50)] # G. C. Greubel, Sep 04 2019
Formula
a(n) = ((2*n+1)^2 -1)/2 + 1.
a(n) = a(n-1) + 4*n for n>1, a(1)=5. - Vincenzo Librandi, Nov 17 2010
From Colin Barker, Nov 03 2012: (Start)
a(n) = 1 + 2*n + 2*n^2.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3).
G.f.: x*(5 -2*x +x^2)/(1-x)^3. (End)
All other formulas given in A001844 also apply, with the restriction n>0. - M. F. Hasler, Nov 03 2012
E.g.f.: -1 +(1 +4*x +2*x^2)*exp(x). - G. C. Greubel, Sep 04 2019
Comments