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 A187093 #44 Jan 05 2023 15:49:42 %S A187093 0,1,1,3,8,13,17,23,32,41,49,59,72,85,97,111,128,145,161,179,200,221, %T A187093 241,263,288,313,337,363,392,421,449,479,512,545,577,611,648,685,721, %U A187093 759,800,841,881,923,968,1013,1057,1103,1152,1201,1249,1299,1352,1405,1457 %N A187093 a(0)=0, a(1)=a(2)=1; thereafter, a(n+1) = n^2 - a(n-1). %C A187093 The original definition was equivalent to: Let S(n) = sum_{i=0..n} a(i), then n^2+a(n)-S(n+1) = S(n-2). This in turn simplifies to the present definition. %H A187093 Harvey P. Dale, <a href="/A187093/b187093.txt">Table of n, a(n) for n = 0..1000</a> %H A187093 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (3,-4,4,-3,1). %F A187093 a(n) = (n^2 - 1 + (-1)^floor(n/2) * A000034(n))/2. %F A187093 G.f.: x*(-1+2*x+x^3-4*x^2) / ( (x^2+1)*(x-1)^3 ). %F A187093 a(2^(n+1)) = A081654(n). - _Anton Zakharov_, Sep 13 2016 %p A187093 A000034 := proc(n) op(1+(n mod 2),[1,2]) ; end proc: %p A187093 A187093 := proc(n) (n^2-1+(-1)^floor(n/2)*A000034(n))/2 ;end proc: # _R. J. Mathar_ %t A187093 LinearRecurrence[{3, -4, 4, -3, 1}, {0, 1, 1, 3, 8}, 60] (* _Jean-François Alcover_, Mar 30 2020 *) %t A187093 Join[{0},RecurrenceTable[{a[1]==a[2]==1,a[n+1]==n^2-a[n-1]},a,{n,60}]] (* _Harvey P. Dale_, Jan 05 2023 *) %o A187093 (Python) %o A187093 print(0, end=',') # a(-1)=0 %o A187093 prpr = prev = 1 # a(0)=a(1)=1 %o A187093 for n in range(2, 77): %o A187093 print(prpr, end=',') %o A187093 curr = n*n - prpr # a(n) = n^2 - a(n-2) %o A187093 prpr = prev %o A187093 prev = curr %o A187093 # from _Alex Ratushnyak_, Aug 05 2012 %o A187093 (PARI) a(n) = (n^2-1+(-1)^(n\2)*(1 + (n % 2)))/2; \\ _Michel Marcus_, Sep 11 2016 %Y A187093 Cf. A194274, A081654. %K A187093 nonn %O A187093 0,4 %A A187093 _Benjamin Coinsin_, Mar 04 2011 %E A187093 Edited by _N. J. A. Sloane_, Mar 09 2011 %E A187093 More terms from _Alex Ratushnyak_, Aug 05 2012