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.
%I A095311 #40 Feb 10 2023 09:11:38 %S A095311 1,47,138,274,455,681,952,1268,1629,2035,2486,2982,3523,4109,4740, %T A095311 5416,6137,6903,7714,8570,9471,10417,11408,12444,13525,14651,15822, %U A095311 17038,18299,19605,20956,22352,23793,25279,26810,28386,30007,31673,33384 %N A095311 47-gonal numbers. %D A095311 Albert H. Beiler, "Recreations in the Theory of Numbers", Dover, 1966, pp. 185-194. %H A095311 <a href="/index/Pol#polygonal_numbers">Index to sequences related to polygonal numbers</a> %H A095311 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,1). %F A095311 a(n+3) = 3*a(n+2) - 3*a(n+1) - a(n); a(1) = 1, a(2) = 47, a(3) = 138. %F A095311 Let M = the 3 X 3 matrix [1 0 0 / 1 1 0 / 1 45 1]. Then M^n * [1 0 0] = [1 n a(n)]. %F A095311 From _Colin Barker_, Jul 27 2013: (Start) %F A095311 a(n) = (n*(45*n-43))/2. %F A095311 G.f.: -x*(44*x+1) / (x-1)^3. (End) %F A095311 E.g.f.: exp(x)*(x + 45*x^2/2). - _Nikolaos Pantelidis_, Feb 10 2023 %e A095311 a(6) = 681 = 3*a(5) - 3*a(4) + a(3) = 3*455 - 3*274 + 138. %e A095311 a(37) = 30007 since M^37 * [1 0 0] = [1 37 30007]. %t A095311 a[n_] := (MatrixPower[{{1, 0, 0}, {1, 1, 0}, {1, 45, 1}}, n].{{1}, {0}, {0}})[[3, 1]]; Table[ a[n], {n, 40}] (* _Robert G. Wilson v_, Jun 05 2004 *) %t A095311 LinearRecurrence[{3, -3, 1}, {1, 47, 138}, 40] (* _Vincenzo Librandi_, Jul 25 2015 *) %t A095311 PolygonalNumber[47,Range[40]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Dec 01 2016 *) %o A095311 (Magma) I:=[1,47,138]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+Self(n-3): n in [1..40]]; // _Vincenzo Librandi_, Jul 25 2015 %o A095311 (PARI) a(n)=([0,1,0; 0,0,1; 1,-3,3]^(n-1)*[1;47;138])[1,1] \\ _Charles R Greathouse IV_, Jun 17 2017 %Y A095311 Cf. A081422, A000326, A000384, A000566, A000567, ... (all polygonal sequences). %K A095311 nonn,easy %O A095311 1,2 %A A095311 _Gary W. Adamson_, Jun 02 2004 %E A095311 Edited by _N. J. A. Sloane_ and _Robert G. Wilson v_, Jun 05 2004