login
A293835
a(n) = 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 an integer; a(1)=1. No two numbers with the same absolute value may appear. Preference is given to positive values of a(n).
2
1, 3, 2, 6, -7, -5, 0, 8, 10, 12, 14, 4, -9, -11, -13, -15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 16, -18, -20, -22, -24, -26, -28, -30, -32, -34, -36, -38, -40, -42, -44, -46, -48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78
OFFSET
1,2
COMMENTS
For n=1: 1/1 is an integer, and so is -1/1, but preference is given to positive values of a(n).
Fixed points so far: 1,8,17,50; i.e., aside from 1, these fixed points occur when sequence changes from 0 to positive or from negative to positive.
One could check the integers in order of appearance in A001057 to see if they are the next term. - David A. Corneth, Nov 13 2017
LINKS
EXAMPLE
For n=7: (1 + 3 + 2 + 6 - 7 - 5 + 0)/7 is an integer.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = For[k = 0, True, k++, aa = Array[a, n - 1]; If[FreeQ[aa, k | -k], If[IntegerQ[Mean[Append[aa, k]]], Return[k]]; If[IntegerQ[Mean[Append[aa, -k]]], Return[-k]]]];
Array[a, 100] (* Jean-François Alcover, Dec 09 2017 *)
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Enrique Navarrete, Oct 16 2017
STATUS
approved