

A332106


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


1



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



OFFSET

0,1


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


LINKS



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.


EXAMPLE

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.


PROG

(PARI) apply( A332106(n)={my(r=1, p=2*(r+n)1, s=2<<exponent(n+!n), q=2*(sn)+1); while(n, if(pn<q+n1, isprime(p)&&return(pn); p+=r*=2, isprime(q)&&return(q+n1); q+=s*=2)); 2} , [0..77])


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



