login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A292348 "Pri-most" numbers: the majority of bits in the binary representation of these numbers satisfy the following: complementing this bit produces a prime number. 2

%I #28 May 24 2021 07:33:50

%S 6,7,15,19,21,23,27,43,45,63,71,75,77,81,99,101,105,111,135,147,159,

%T 165,175,183,189,195,225,231,235,237,243,255,261,273,285,309,315,335,

%U 345,357,363,375,381,423,435,483,495,507,553,555,573,585,645,663,669,675

%N "Pri-most" numbers: the majority of bits in the binary representation of these numbers satisfy the following: complementing this bit produces a prime number.

%C Conjecture: the sequence is infinite.

%H Alois P. Heinz, <a href="/A292348/b292348.txt">Table of n, a(n) for n = 1..1000</a>

%e 23 is 10111 in binary, 23 XOR {1,2,4,8,16} = {22,21,19,31,7}, three times a prime was produced, namely 19,31,7, versus two composites, 22 and 21. More primes than composites, therefore 23 is a term.

%p a:= proc(n) option remember; local k; for k from 1+a(n-1) while add(

%p `if`(isprime(Bits[Xor](k, 2^i)), 1, -1), i=0..ilog2(k))<1 do od; k

%p end: a(0):=0:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Dec 07 2017

%t okQ[n_] := Module[{cnt, f}, cnt = Thread[f[n, 2^Range[0, Log[2, n] // Floor]]] /. f -> BitXor // PrimeQ; Count[cnt, True] > Length[cnt]/2];

%t Select[Range[1000], okQ] (* _Jean-François Alcover_, Oct 04 2019 *)

%o (Python)

%o from sympy import isprime

%o for i in range(1000):

%o delta = 0 # foundPrime - nonPrime

%o bit = 1

%o while bit <= i:

%o if isprime(i^bit): delta += 1

%o else: delta -= 1

%o bit*=2

%o if delta > 0: print(str(i), end=',')

%Y Cf. A000040, A137985, A292349.

%K nonn,base

%O 1,1

%A _Alex Ratushnyak_, Dec 07 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)