login
A338699
Sequence A is the primes. Sequence B is the "smallest" sequence of nondecreasing powers of two whose sum over the first N terms is at least equal to the sum over the first N terms of Sequence A. a(n) is the amount by which the sum of the first n terms of Sequence B exceeds the sum of the first n terms of Sequence A.
2
0, 1, 0, 1, 6, 9, 8, 5, 14, 17, 18, 13, 4, 25, 42, 53, 58, 61, 58, 51, 42, 27, 8, 47, 78, 105, 130, 151, 170, 185, 186, 183, 174, 163, 142, 119, 90, 55, 16, 99, 176, 251, 316, 379, 438, 495, 540, 573, 602, 629, 652, 669, 684, 689, 688, 681, 668, 653, 632, 607, 580
OFFSET
1,5
COMMENTS
The definition is due to Jack Brennen.
EXAMPLE
We want to produce prime numbers out of nondecreasing "blocks" of powers of 2. Each time we use one block in addition to the remains of the previous block. To get 2, we need a block of 2. So a(1) = 2-2 = 0. To get 3, we need a block of 4. So a(2) = 4-3 = 1. To get 5, we need a block of 4 in addition to the remains of the previous block. So a(3) = 4+1-5 = 0.
PROG
(PARI) accum=0; inc=2; forprime(p=2, 99, while(accum+inc<p, inc*=2); accum+=inc-p; print(accum)); \\ Jack Brennen, Jan 28 2021
(PARI) m=d=0; [ d+=2<<exponent(m=max(p-d-1, m))-p | p<-primes(50)] \\ M. F. Hasler, Jan 30 2021
CROSSREFS
Sequence in context: A335028 A153603 A198557 * A198214 A374643 A340808
KEYWORD
nonn
AUTHOR
Ali Sada, Apr 24 2021
STATUS
approved