%I #106 Jul 19 2024 08:21:05
%S 1,6,17,34,57,86,121,162,209,262,321,386,457,534,617,706,801,902,1009,
%T 1122,1241,1366,1497,1634,1777,1926,2081,2242,2409,2582,2761,2946,
%U 3137,3334,3537,3746,3961,4182,4409,4642,4881,5126,5377,5634,5897,6166,6441
%N Fifth spoke of a hexagonal spiral.
%C Squared distance from (0,0,-1) to (n,n,n) in R^3. - _James R. Buddenhagen_, Jun 15 2013
%H Vincenzo Librandi, <a href="/A056109/b056109.txt">Table of n, a(n) for n = 0..1000</a>
%H Henry Bottomley, <a href="/A003215/a003215.gif">Illustration of initial terms</a>
%H Tanya Khovanova, <a href="http://www.tanyakhovanova.com/RecursiveSequences/RecursiveSequences.html">Recursive Sequences</a>
%H G. Nebe and N. J. A. Sloane, <a href="http://www.math.rwth-aachen.de/~Gabriele.Nebe/LATTICES/A2.html">Home page for hexagonal (or triangular) lattice A2</a>
%H Leo Tavares, <a href="/A056109/a056109.jpg">Triple Diamond Illustration</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,1).
%F a(n) = 3n^2+2n+1 = a(n-1)+6n-1 = 2a(n-1)-a(n-2)+6 = 3a(n-1)-3a(n-2)+a(n-3) = A056105(n)+4n = A056106(n)+3n = A056107(n)+2n = A056108(n)+n = A003215(n)-n.
%F G.f.: (1+3*x+2*x^2)/(1-3*x+3*x^2-x^3). - _Colin Barker_, Jan 04 2012
%F G.f.: (1 + x) * (1 + 2*x) / (1 - x)^3. - _Michael Somos_, Feb 04 2012
%F a(n) = A008810(3*n + 1) = A056105(-n). - _Michael Somos_, Aug 03 2006
%F E.g.f.: exp(x)*(1 + 5*x + 3*x^2). - _Stefano Spezia_, Oct 06 2018
%F a(n) = A000290(n+1) + 2*A000290(n). - _Leo Tavares_, May 29 2023
%F a(n) = A069894(n) - A000290(n+1). - _Jarrod G. Sage_, Jul 19 2024
%p seq(coeff(series(n!*(exp(x)*(3*x^2+5*x+1)),x,n+1), x, n), n = 0 .. 50); # _Muniru A Asiru_, Oct 07 2018
%t Table[3 n^2 + 2 n + 1, {n, 0, 100}] (* _Vincenzo Librandi_, Mar 15 2013 *)
%t LinearRecurrence[{3,-3,1},{1,6,17},60] (* _Harvey P. Dale_, Mar 28 2019 *)
%o (PARI) {a(n) = 3*n^2 + 2*n + 1}; /* _Michael Somos_, Aug 03 2006 */
%o (PARI) Vec((1+3*x+2*x^2)/(1-3*x+3*x^2-x^3)+O(x^100)) \\ _Stefano Spezia_, Oct 17 2018
%o (Magma) [3*n^2 + 2*n + 1: n in [0..50]]; // _Vincenzo Librandi_, Mar 15 2013
%o (GAP) List([0..50],n->3*n^2+2*n+1); # _Muniru A Asiru_, Oct 07 2018
%o (Python) for n in range(0, 100): print(int(3*n**2 + 2*n + 1), end=', ') # _Stefano Spezia_, Oct 16 2018
%Y Cf. A008810, A122430 (prime terms).
%Y Other spokes: A003215, A056105, A056106, A056107, A056108.
%Y Other spirals: A054552.
%Y Cf. A000290.
%K easy,nonn
%O 0,2
%A _Henry Bottomley_, Jun 09 2000