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 A296069 #19 Mar 15 2020 09:34:37 %S A296069 0,2,1,5,-3,7,-5,9,-7,11,-9,13,-11,15,-13,17,-15,19,-17,21,-19,23,-21, %T A296069 25,-23,27,-25,29,-27,31,-29,33,-31,35,-33,37,-35,39,-37,41,-39,43, %U A296069 -41,45,-43,47,-45,49,-47,51,-49,53,-51 %N A296069 a(1)=0; thereafter a(n) is the smallest number (in absolute value) not yet in the sequence such that the arithmetic mean of the first n terms a(1), a(2), ..., a(n) is a nonzero integer. Preference is given to positive values of a(n). %H A296069 Colin Barker, <a href="/A296069/b296069.txt">Table of n, a(n) for n = 1..1000</a> %H A296069 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,1,1). %F A296069 From _Colin Barker_, Mar 14 2020: (Start) %F A296069 G.f.: x^2*(2 + 3*x + 4*x^2 - x^3 - 2*x^4) / ((1 - x)*(1 + x)^2). %F A296069 a(n) = -a(n-1) + a(n-2) + a(n-3) for n>6. %F A296069 (End) %t A296069 Nest[Append[#, Block[{k = 1, s = 1}, While[Nand[FreeQ[#, s k], And[IntegerQ@ Mean@ #, Total@ # != 0] &@ Append[#, s k]], If[s == 1, s = -1, k++; s = 1]]; s k]] &, {0}, 52] (* _Michael De Vlieger_, Dec 12 2017 *) %o A296069 (PARI) concat(0, Vec(x^2*(2 + 3*x + 4*x^2 - x^3 - 2*x^4) / ((1 - x)*(1 + x)^2) + O(x^65))) \\ _Colin Barker_, Mar 14 2020 %Y A296069 Cf. A296063, A296064, A296070 (partial sums). %K A296069 sign %O A296069 1,2 %A A296069 _Enrique Navarrete_, Dec 04 2017