The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A282864 Lexicographic first permutation of the nonnegative integers such that the partial sums of s(n)*a(n) always remain nonnegative, where s(n) = +1 if a(n) is prime, -1 else. 6
 0, 2, 1, 3, 4, 5, 7, 6, 11, 8, 9, 13, 10, 17, 12, 19, 14, 23, 15, 16, 29, 18, 31, 20, 21, 37, 22, 41, 24, 25, 43, 26, 27, 47, 28, 53, 30, 32, 59, 33, 34, 61, 35, 67, 36, 38, 71, 39, 40, 73, 42, 44, 79, 45, 83, 46, 48, 89, 49, 50, 97, 51, 52, 101, 54, 55, 103, 56, 107, 57, 58, 109, 60, 62, 113, 63, 64, 127, 65, 66, 131, 68, 69, 137, 70, 139, 72, 74, 149 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,2 COMMENTS For n > 0, also absolute values of first differences of A282846. LINKS EXAMPLE Start with the smallest possible nonnegative number, 0. The partial sum remains 0 and is too small to allow subtraction of the nonprime number 1, so we add the least prime, 2, and the partial sum becomes 2. Now we can use 1, which will be subtracted, giving the partial sum 1. The smallest unused number is 3 which is prime and can be added, giving a sum of 4. This also allows us to use the next larger integer 4, subtracted since nonprime, to give a sum of 0. The prime number 5 can be added to yield 5, but the next larger integer is 6, too large to be subtracted, so the next prime, 7, comes before and is added to yield 12. Now 6 can be subtracted (sum = 6), but not the next unused number 8, nor 9, nor 10. Prior to using them, we add the next prime, 11, to yield sum = 17. Now 8 and then 9 can be subtracted, and so on. PROG (PARI) {print1(a=0); c=1; p=2; for(n=1, 99, print1(", "abs(a+0*if(a

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

Last modified February 20 22:47 EST 2020. Contains 332086 sequences. (Running on oeis4.)