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 A030640 #30 Aug 05 2024 09:55:11 %S A030640 1,1,-3,-2,5,3,-7,-4,9,5,-11,-6,13,7,-15,-8,17,9,-19,-10,21,11,-23, %T A030640 -12,25,13,-27,-14,29,15,-31,-16,33,17,-35,-18,37,19,-39,-20,41,21, %U A030640 -43,-22,45,23,-47,-24,49,25,-51,-26,53,27,-55,-28,57,29,-59 %N A030640 Discriminant of lattice A_n of determinant n+1. %D A030640 J. H. Conway, The Sensual Quadratic Form, Mathematical Association of America, 1997, p. 4. %D A030640 G. L. Watson, Integral Quadratic Forms, Cambridge University Press, p. 2. %H A030640 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,-2,0,-1). %F A030640 a(2n) = (-1)^n*(2*n+1), a(2n+1) = (-1)^n*(n+1). Or (apart from signs and with offset 1), a(n) = n, n odd; n/2, n even. %F A030640 G.f.: (1+x-x^2)/(1+x^2)^2. - _Len Smiley_ %F A030640 a(-2-n) = (-1)^n * a(n). - _Michael Somos_, Jun 15 2005 %F A030640 a(n) = -2*a(n-2) - a(n-4); a(0)=1, a(1)=1, a(2)=-3, a(3)=-2. - _Harvey P. Dale_, Dec 02 2011 %F A030640 a(n) = (-1)^floor(n/2)*A026741(n+1). %F A030640 a(2*n) = A157142(n). a(2*n - 1) = A181983(n). - _Michael Somos_, Feb 22 2016 %e A030640 G.f. = 1 + x - 3*x^2 - 2*x^3 + 5*x^4 + 3*x^5 - 7*x^6 - 4*x^7 + 8*x^9 + 5*x^10 + ... %t A030640 CoefficientList[Series[(1+x-x^2)/(1+x^2)^2,{x,0,60}],x] (* or *) LinearRecurrence[{0,-2,0,-1},{1,1,-3,-2},70] %t A030640 a[ n_] := With[{m = n + 1}, m I^m / If[ Mod[ m, 2] == 1, I, -2]]; (* _Michael Somos_, Jun 11 2013 *) %o A030640 (PARI) {a(n) = if( n==-1, 0, (-1)^(n\2) * (n+1) / gcd(n+1, 2))}; /* _Michael Somos_, Jun 15 2005 */ %o A030640 (Python) %o A030640 def A030640(n): return (-(n+1>>1) if n&2 else n+1>>1) if n&1 else (-n-1 if n&2 else n+1) # _Chai Wah Wu_, Aug 05 2024 %Y A030640 Cf. A026741 is unsigned version. %Y A030640 Cf. A157142, A181983. %K A030640 sign,easy,nice %O A030640 0,3 %A A030640 _N. J. A. Sloane_