OFFSET
1,1
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..2014
EXAMPLE
59 is in the sequence because the decimal representation of its Elias gamma code is 2011 and both 59 and 2011 are prime numbers.
PROG
(Python)
import math
from sympy import isprime
def unary(n):
....return "1"*(n-1)+"0"
def elias_gamma(n):
....if n ==1:
........return "1"
....k=int(math.log(n, 2))
....fp=unary(1+k) #fp is the first part
....sp=n-2**(k) #sp is the second part
....nb=k #nb is the number of bits used to store sp in binary
....sp=bin(sp)[2:]
....if len(sp)<nb:
........sp=("0"*(nb-len(sp)))+sp
....return int(fp+sp, 2)
i=1
j=1
while j<=2014:
....if isprime(i)==True and isprime(elias_gamma(i))==True:
........print str(j)+" "+str(i)
........j+=1
....i+=1
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Jan 24 2017
STATUS
approved