login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A322743 Least composite such that complementing one bit in its binary representation at a time produces exactly n primes. 1
8, 4, 6, 15, 21, 45, 111, 261, 1605, 1995, 4935, 8295, 69825, 268155, 550725, 4574955, 13996605, 12024855, 39867135, 398467245, 1698754365, 16351800465, 72026408685, 120554434875 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

LINKS

Table of n, a(n) for n=0..23.

FORMULA

From Chai Wah Wu, Jan 03 2019: (Start)

a(n) >= 2^n+1, if it exists. a(n) is odd for n > 2, if it exists.

It is clear these are true for n <= 2. Suppose n > 2. If a(n) is even, then complementing any bits that is not LSB or MSB will result in an even nonprime number. If a(n) is odd, then complementing the LSB will result in an even nonprime number. So either case shows that a(n) has n+1 or more binary bits. It also shows that a(n) must be odd.

Conjecture: a(n) mod 10 == 5 for n > 7. (End)

EXAMPLE

a(1) = 4 because 4 in base 2 is 100 and 000 is 0, 110 is 6 and 101 is 5: hence only one prime.

a(2) = 6 because 6 in base 2 is 110 and 010 is 2, 100 is 4 and 111 is 7: hence two primes.

MAPLE

a:= proc(n) local k; for k from 2^n+1 while isprime(k) or n<>add(

      `if`(isprime(Bits[Xor](k, 2^j)), 1, 0), j=0..ilog2(k)) do od; k

    end:

seq(a(n), n=0..12);  # Alois P. Heinz, Jan 03 2019

PROG

(Python)

from sympy import isprime

def A322743(n):

    i = 4 if n <= 1 else 2**n+1

    j = 1 if n <= 2 else 2

    while True:

        if not isprime(i):

            c = 0

            for m in range(len(bin(i))-2):

                if isprime(i^(2**m)):

                    c += 1

                if c > n:

                    break

            if c == n:

                return i

        i += j # Chai Wah Wu, Jan 03 2019

CROSSREFS

Cf. A002808, A137985.

Sequence in context: A253073 A090325 A090469 * A168546 A195346 A096427

Adjacent sequences:  A322740 A322741 A322742 * A322744 A322745 A322746

KEYWORD

nonn,base

AUTHOR

Paolo P. Lava, Dec 24 2018

EXTENSIONS

Definition clarified by Chai Wah Wu, Jan 03 2019

a(19) added and a(0) corrected by Rémy Sigrist, Jan 03 2019

a(20)-a(23) from Giovanni Resta, Jan 03 2019

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 29 10:41 EDT 2020. Contains 334699 sequences. (Running on oeis4.)