login
A100813
Smallest number in base 2 which is also prime in base 2+n, or 0 if no such number exists.
1
10, 11, 10, 11, 10, 111, 1011, 11, 10, 11, 10, 101, 111, 11, 10, 11, 10, 101, 111, 11, 10, 101, 111011, 101, 111, 11, 10, 11, 10, 1011, 111, 10001, 1101, 11, 10, 111, 1011, 11, 10, 11, 10, 1011, 1101, 11, 10, 1011, 1100111, 111, 101001, 11, 10, 101, 111011, 101
OFFSET
1,1
LINKS
EXAMPLE
a(6) = 111: 111 (base 2) = 7, which is prime; 111 (base 2+6) = 73, which is prime.
MATHEMATICA
a = {}; Do[ k = 1; While[ ! PrimeQ[FromDigits[IntegerDigits[Prime[k], 2], 2 + n]], k++ ]; AppendTo[a, FromDigits[IntegerDigits[Prime[k], 2], 10]]; , {n, 50}]; a (* Ray Chandler, Jan 10 2005 *)
PROG
(Python)
from sympy import isprime, nextprime
def fd(s, b): return sum(b**i for i, si in enumerate(s[::-1]) if si=='1')
def a(n):
p = 2
while not isprime(fd(bin(p)[2:], n+2)): p = nextprime(p)
return int(bin(p)[2:])
print([a(n) for n in range(1, 55)]) # Michael S. Branicky, Aug 20 2022
CROSSREFS
Sequence in context: A020509 A373696 A103181 * A085209 A085217 A085210
KEYWORD
base,nonn
AUTHOR
Ray G. Opao, Jan 05 2005
EXTENSIONS
Corrected and extended by Ray Chandler, Jan 10 2005
a(51) and beyond from Michael S. Branicky, Aug 09 2022
STATUS
approved