cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A332106 Least m > n such that n + ... + m = p*2^k with p prime and k >= 0.

Original entry on oeis.org

2, 2, 3, 4, 7, 6, 7, 9, 9, 10, 13, 12, 19, 16, 15, 16, 31, 20, 19, 22, 21, 22, 25, 24, 40, 28, 27, 34, 31, 30, 31, 33, 35, 34, 37, 36, 37, 52, 41, 40, 43, 42, 169, 46, 45, 52, 61, 50, 49, 52, 51, 52, 55, 54, 55, 58, 57, 184, 70, 69, 67, 67, 65, 64, 67, 66, 73, 70, 69, 70, 442
Offset: 0

Views

Author

M. F. Hasler, Aug 29 2020

Keywords

Comments

Numbers of the form p*2^k (A038550) are the integers having a unique representation as sum of two or more consecutive positive integers, n + ... + m with m > n > 0.
This function is useful for computing A336897 in an efficient way

Examples

			0 + 1 = 1 is not of the required form, but 0 + 1 + 2 = 3 is, so a(0) = 2.
For n = 1, n + 2 = 3 is of the required form, hence a(1) = 2.
For n = 2, n + 3 = 5 is of the required form, hence a(2) = 3.
For n = 3, n + 4 = 7 is of the required form, hence a(3) = 4.
For n = 4, 4 + 5 = 9 and 4 + 5 + 6 = 15 are not of the required form, but 4 + 5 + 6 + 7 = 22 = 11*2 is, hence a(4) = 7.
		

Crossrefs

Programs

  • PARI
    apply( A332106(n)={my(r=1, p=2*(r+n)-1, s=2<
    				

Formula

a(n) = min {p - n, q + n - 1}, where p = 2^r + 2n - 1 and q = 2^s - 2n + 1 are the smallest primes of the respective form.