login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Prime numbers ordered by their binary reversal.
1

%I #15 Feb 17 2022 14:17:44

%S 2,3,5,7,13,11,17,29,19,23,31,41,37,53,61,43,59,47,97,113,73,89,101,

%T 109,67,83,107,71,103,79,127,193,241,137,233,197,229,149,181,173,157,

%U 131,163,227,211,179,139,251,199,167,151,239,223,191,257,449,353,401

%N Prime numbers ordered by their binary reversal.

%C See A104154 for the base-10 variant.

%C Mersenne primes (A000668) and Fermat primes (A019434) appear at their natural position.

%H Rémy Sigrist, <a href="/A351528/b351528.txt">Table of n, a(n) for n = 1..6542</a>

%e The first terms, alongside their binary and reverse binary expansions, are:

%e n a(n) bin(a(n)) bin(rev(a(n)))

%e -- ---- --------- --------------

%e 1 2 10 1

%e 2 3 11 11

%e 3 5 101 101

%e 4 7 111 111

%e 5 13 1101 1011

%e 6 11 1011 1101

%e 7 17 10001 10001

%e 8 29 11101 10111

%e 9 19 10011 11001

%e 10 23 10111 11101

%e 11 31 11111 11111

%t SortBy[Select[Range[2^9], PrimeQ], IntegerReverse[#, 2] &] (* _Amiram Eldar_, Feb 15 2022 *)

%o (PARI) rev(n) = fromdigits(Vecrev(binary(n)), 2)

%o print (vecsort(primes([1, 2^9]), (p,q)->rev(p)-rev(q))[1..58])

%o (Python)

%o from itertools import count, islice

%o from sympy import primerange

%o def A351528_gen(): # generator of terms

%o yield from (int(d[::-1],2) for l in count(1) for d in sorted(bin(m)[:1:-1] for m in primerange(2**(l-1),2**l)))

%o A351528_list = list(islice(A351528_gen(),20)) # _Chai Wah Wu_, Feb 17 2022

%Y Cf. A000668, A019434, A030101, A098957, A104154.

%K nonn,base

%O 1,1

%A _Rémy Sigrist_, Feb 13 2022