login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A281551 Prime numbers p such that the decimal representation of its Elias gamma code is also a prime. 1
3, 23, 41, 47, 59, 89, 101, 149, 179, 227, 317, 347, 353, 383, 389, 479, 503, 599, 821, 887, 929, 977, 1019, 1109, 1229, 1283, 1319, 1511, 1571, 1619, 1667, 1709, 1733, 1787, 1847, 1889, 1907, 1913, 1931, 2207, 2309, 2333, 2357, 2399, 2417, 2459, 2609, 2753, 2789, 2909, 2963, 2999, 3203, 3257, 3299 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
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
Cf. A000040, A171885 (decimal representation of Elias gamma code), A281149, A281316.
Sequence in context: A370601 A116893 A106066 * A167216 A309935 A212396
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Jan 24 2017
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)