[go: up one dir, main page]

login
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
6, 7, 15, 19, 21, 23, 27, 43, 45, 63, 71, 75, 77, 81, 99, 101, 105, 111, 135, 147, 159, 165, 175, 183, 189, 195, 225, 231, 235, 237, 243, 255, 261, 273, 285, 309, 315, 335, 345, 357, 363, 375, 381, 423, 435, 483, 495, 507, 553, 555, 573, 585, 645, 663, 669, 675
OFFSET
1,1
COMMENTS
Conjecture: the sequence is infinite.
LINKS
EXAMPLE
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.
MAPLE
a:= proc(n) option remember; local k; for k from 1+a(n-1) while add(
`if`(isprime(Bits[Xor](k, 2^i)), 1, -1), i=0..ilog2(k))<1 do od; k
end: a(0):=0:
seq(a(n), n=1..100); # Alois P. Heinz, Dec 07 2017
MATHEMATICA
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];
Select[Range[1000], okQ] (* Jean-François Alcover, Oct 04 2019 *)
PROG
(Python)
from sympy import isprime
for i in range(1000):
delta = 0 # foundPrime - nonPrime
bit = 1
while bit <= i:
if isprime(i^bit): delta += 1
else: delta -= 1
bit*=2
if delta > 0: print(str(i), end=', ')
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Dec 07 2017
STATUS
approved