login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
E. Angelini, Minimizing Q, SeqFan list, Nov 11 2014.
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
Cf. A250072.
Sequence in context: A153152 A153153 A175058 * A334999 A154437 A305428
KEYWORD
nonn
AUTHOR
Eric Angelini and M. F. Hasler, Nov 11 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 19:31 EDT 2024. Contains 371962 sequences. (Running on oeis4.)