OFFSET
0,2
COMMENTS
For n > 0, also absolute values of first differences of A282846.
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<c, a+=p; p=nextprime(p+1), a-=c; while(isprime(c++), ))-a)))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and M. F. Hasler, Feb 23 2017
STATUS
approved