

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
(list;
graph;
refs;
listen;
history;
text;
internal format)



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:])


CROSSREFS



KEYWORD

base,nonn


AUTHOR



EXTENSIONS



STATUS

approved



