Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Positive integers k such that k + p is a power of 2, where p is the least prime greater than k.
0

%I #28 Sep 11 2022 10:31:08

%S 3,15,61,255,2043,4093,32765,65535,262141,8388599,33554397,134217699,

%T 268435453,1073741821,17179869159,137438953463,274877906937,

%U 1099511627761,8796093022179,17592186044409,70368744177649,140737488355323,281474976710635,562949953421243

%N Positive integers k such that k + p is a power of 2, where p is the least prime greater than k.

%C The corresponding sequence of primes is the intersection of A014210 and A356434 without the initial 2.

%e 3 + 5 = 8;

%e 15 + 17 = 32;

%e 61 + 67 = 128.

%o (Python)

%o from itertools import islice

%o from sympy import nextprime

%o def A356421_gen():

%o m = 1

%o while True:

%o n = m+1<<1

%o k = m

%o p = nextprime(k)

%o while k+p>n:

%o k -=1

%o p = nextprime(k)

%o if k+p==n:

%o yield k

%o m = n-1

%o A356421_list = list(islice(A356421_gen(),30)) # _Chai Wah Wu_, Sep 11 2022

%Y Cf. A000040, A000079, A014210, A356434.

%K nonn

%O 1,1

%A _Ali Sada_, Aug 06 2022

%E Terms from _Tom Duff_ via Seqfan.