|
|
A250090
|
|
a(0)=1; for n>0, a(n) is the number not yet used which yields the smallest possible positive sum_{k=0..n} (-1)^(a(k)+1)*a(k).
|
|
2
|
|
|
1, 0, 3, 2, 5, 6, 7, 4, 9, 12, 11, 10, 13, 14, 15, 8, 17, 24, 19, 18, 21, 22, 23, 20, 25, 28, 27, 26, 29, 30, 31, 16, 33, 48, 35, 34, 37, 38, 39, 36, 41, 44, 43, 42, 45, 46, 47, 40, 49, 56, 51, 50, 53, 54, 55, 52, 57, 60, 59, 58, 61, 62, 63, 32, 65, 96, 67, 66, 69, 70, 71, 68, 73, 76, 75, 74, 77, 78, 79, 72, 81, 88, 83, 82, 85, 86, 87, 84, 89, 92, 91
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Odd terms are added, even terms are subtracted. At each step, the next term is chosen among numbers which did not yet occur, as to minimize this sum.
|
|
LINKS
|
|
|
PROG
|
(PARI) A250090(n=100, a=1, Q=0, u=[])={for(n=1, n, print1(a", "); u=setunion(u, Set(a)); Q-=(-1)^a*a; forstep(k=2-Q%2, Q, 2, setsearch(u, Q-k)&&next; a=Q-k; next(2)); forstep(k=1, 9e9, 2, setsearch(u, k)&&next; a=k; next(2))); a} \\ returns a(n) and prints out a(k) for 0<=k<n.
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|