login
A282865
Lexicographic first permutation of the nonnegative integers such that the partial sums of (-1)^isprime(a(n))*a(n) always remain nonnegative.
4
0, 1, 4, 2, 3, 6, 5, 8, 7, 9, 11, 10, 12, 13, 14, 17, 15, 19, 16, 18, 23, 20, 29, 21, 22, 31, 24, 37, 25, 26, 41, 27, 28, 43, 30, 47, 32, 33, 53, 34, 35, 59, 36, 61, 38, 39, 67, 40, 42, 71, 44, 45, 73, 46, 79, 48, 49, 83, 50, 51, 89, 52, 54, 97, 55, 56, 101, 57, 103, 58, 60, 107, 62, 63, 109, 64, 65, 113, 66, 68, 127, 69, 70, 131, 72, 137, 74, 75
OFFSET
0,3
COMMENTS
A variant of A282864, having the same definition except for opposite signs.
PROG
(PARI) {print1(s=0); c=1; p=2; for(n=1, 199, if(s>=p, a=-p; p=nextprime(p+1), a=c; while(isprime(c++), )); print1(", "abs(a)); s+=a)}
CROSSREFS
Sequence in context: A128009 A072425 A361747 * A377137 A241051 A275590
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 23 2017
STATUS
approved