login
Numbers k such that 2^k - 1 - Sum_{prime p<k} 2^p is prime.
1

%I #24 Aug 08 2024 12:12:57

%S 2,3,4,5,6,7,8,21,25,33,40,58,157,158,226,239,240,295,465,730,1774,

%T 2184,2351,2352,3279,4221,6340,6373,6374,17822,18591,19456,24410,

%U 32085,64534

%N Numbers k such that 2^k - 1 - Sum_{prime p<k} 2^p is prime.

%C The primes of this form can be written with k binary digits, which are 0 in prime positions and 1 in all other positions. Here, "position p" means the digit with value 2^p (so the LSB is position 0). See A215891 for a variant where the rightmost bit is position 1.

%C a(36) > 10^5. - _Michael S. Branicky_, Aug 08 2024

%H G. L. Honaker, Jr. and Chris Caldwell (Eds.), <a href="https://t5k.org/curios/page.php?short=5461">Prime curio for 5461</a>.

%e k=2, 3 and 4 are in the sequence because 2^2 - 1 = 2^3 - 1 - 2^2 = 2^4 - 1 - 2^2 - 2^3 = 3 is prime. (For k=3 and k=4, since the uppermost digits are set to zero, one gets the same prime as for k=2 which is in fact only of binary length 2.)

%e k=5 and k=6 are in the sequence because 2^5 - 1 - 2^2 - 2^3 = 2^6 - 1 - 2^2 - 2^3 - 2^5 = 19 is prime. (For k=6, 2^5 cancels the uppermost bit so again we have only 5 binary digits.)

%e k=7 and k=8 are in the sequence because 2^7 - 1 - 2^2 - 2^3 - 2^5 = 2^8 - 1 - 2^2 - 2^3 - 2^5 - 2^7 = 83 is prime. (Here again, 2^7 cancels the uppermost bit so we have only 7 binary digits.) One can see that whenever a term a(n) of the sequence is the larger of a twin prime pair, then a(n+1) = a(n)+1 is also in the sequence and corresponds to the same a(n)-digit prime.

%e k=21 is in the sequence, because 2^21 - 1 - 2^2 - ... - 2^19 = 1431379 is prime (and has binary length 21).

%t isA215888[n_] := PrimeQ[2^n-1 - Sum[2^Prime[k], {k, 1, PrimePi[n-1]}]]; Reap[For[n = 1, n < 10^5, n++, If[isA215888[n], Print[n]; Sow[n]]]][[2, 1]] (* _Jean-François Alcover_, Dec 26 2013, after PARI *)

%o (PARI) is_A215888(N)=ispseudoprime(2^N-1-sum(n=1,primepi(N-1),2^prime(n)))

%K nonn,hard,nice,more

%O 1,1

%A _M. F. Hasler_, Aug 25 2012

%E a(27)-a(35) from _Jean-François Alcover_, Dec 26 2013

%E a(13), a(16), and a(23) inserted by _Michael S. Branicky_, Aug 08 2024