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.

This page as a plain text file.
%I A332106 #5 Sep 20 2020 00:01:55
%S A332106 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,
%T A332106 27,34,31,30,31,33,35,34,37,36,37,52,41,40,43,42,169,46,45,52,61,50,
%U A332106 49,52,51,52,55,54,55,58,57,184,70,69,67,67,65,64,67,66,73,70,69,70,442
%N A332106 Least m > n such that n + ... + m = p*2^k with p prime and k >= 0.
%C A332106 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.
%C A332106 This function is useful for computing A336897 in an efficient way
%F A332106 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.
%e A332106 0 + 1 = 1 is not of the required form, but 0 + 1 + 2 = 3 is, so a(0) = 2.
%e A332106 For n = 1, n + 2 = 3 is of the required form, hence a(1) = 2.
%e A332106 For n = 2, n + 3 = 5 is of the required form, hence a(2) = 3.
%e A332106 For n = 3, n + 4 = 7 is of the required form, hence a(3) = 4.
%e A332106 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.
%o A332106 (PARI) apply( A332106(n)={my(r=1, p=2*(r+n)-1, s=2<<exponent(n+!n), q=2*(s-n)+1); while(n, if(p-n<q+n-1, isprime(p)&&return(p-n); p+=r*=2, isprime(q)&&return(q+n-1); q+=s*=2));2} , [0..77])
%Y A332106 Cf. A038550, A336897.
%K A332106 nonn
%O A332106 0,1
%A A332106 _M. F. Hasler_, Aug 29 2020