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!)
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,5

COMMENTS

The definition is due to Jack Brennen.

LINKS

Rémy Sigrist, Table of n, a(n) for n = 1..10000

Kevin Ryde, Piecewise-Linear Above Cumulative Primes (and LaTeX+PGF source)

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

Cf. A000040, A000079.

Sequence in context: A335028 A153603 A198557 * A198214 A340808 A233589

Adjacent sequences:  A338696 A338697 A338698 * A338700 A338701 A338702

KEYWORD

nonn

AUTHOR

Ali Sada, Apr 24 2021

STATUS

approved

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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 21 22:08 EST 2022. Contains 350480 sequences. (Running on oeis4.)