cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A281551 Prime numbers p such that the decimal representation of its Elias gamma code is also a prime.

This page as a plain text file.
%I A281551 #21 Jun 13 2025 22:43:44
%S A281551 3,23,41,47,59,89,101,149,179,227,317,347,353,383,389,479,503,599,821,
%T A281551 887,929,977,1019,1109,1229,1283,1319,1511,1571,1619,1667,1709,1733,
%U A281551 1787,1847,1889,1907,1913,1931,2207,2309,2333,2357,2399,2417,2459,2609,2753,2789,2909,2963,2999,3203,3257,3299
%N A281551 Prime numbers p such that the decimal representation of its Elias gamma code is also a prime.
%H A281551 Indranil Ghosh, <a href="/A281551/b281551.txt">Table of n, a(n) for n = 1..2014</a>
%e A281551 59 is in the sequence because the decimal representation of its Elias gamma code is 2011 and both 59 and 2011 are prime numbers.
%o A281551 (Python)
%o A281551 import math
%o A281551 from sympy import isprime
%o A281551 def unary(n):
%o A281551     return "1"*(n-1)+"0"
%o A281551 def elias_gamma(n):
%o A281551     if n ==1:
%o A281551         return "1"
%o A281551     k=int(math.log(n,2))
%o A281551     fp=unary(1+k)    #fp is the first part
%o A281551     sp=n-2**(k)      #sp is the second part
%o A281551     nb=k             #nb is the number of bits used to store sp in binary
%o A281551     sp=bin(sp)[2:]
%o A281551     if len(sp)<nb:
%o A281551         sp=("0"*(nb-len(sp)))+sp
%o A281551     return int(fp+sp,2)
%o A281551 i=1
%o A281551 j=1
%o A281551 while j<=2014:
%o A281551     if isprime(i)==True and isprime(elias_gamma(i))==True:
%o A281551         print(str(j)+" "+str(i))
%o A281551         j+=1
%o A281551     i+=1
%Y A281551 Cf. A000040, A171885 (decimal representation of Elias gamma code), A281149, A281316.
%K A281551 nonn,base
%O A281551 1,1
%A A281551 _Indranil Ghosh_, Jan 24 2017