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.

A098957 Decimal value of the reverse binary expansion of the prime numbers.

Original entry on oeis.org

1, 3, 5, 7, 13, 11, 17, 25, 29, 23, 31, 41, 37, 53, 61, 43, 55, 47, 97, 113, 73, 121, 101, 77, 67, 83, 115, 107, 91, 71, 127, 193, 145, 209, 169, 233, 185, 197, 229, 181, 205, 173, 253, 131, 163, 227, 203, 251, 199, 167, 151, 247, 143, 223, 257, 449, 353, 481, 337
Offset: 1

Views

Author

Gil Broussard, Oct 21 2004

Keywords

Comments

15 of the first 16 terms happen to be prime. As terms increase, the preponderance of primes apparently decreases.

Examples

			a(14) = 53 because the 14th prime is 43, or 101011 binary; reverse of 101011 is 110101, or 53 decimal.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local m, r; m, r:= ithprime(n), 0;
          while m>0 do r:= r*2+irem(m, 2, 'm') od; r
        end:
    seq(a(n), n=1..60);  # Alois P. Heinz, Mar 08 2018
  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[Prime[n], 2]], 2], {n, 100}] (* Alonso del Arte, Mar 05 2018 *)
  • PARI
    a(n)=my(v=binary(prime(n)),s);forstep(i=#v,1,-1,s+=s+v[i]);s \\ Charles R Greathouse IV, Aug 17 2011
    
  • Python
    from sympy import prime
    def A098957(n): return int(bin(prime(n))[:1:-1],2) # Chai Wah Wu, Feb 17 2022

Formula

a(n) = decimal(reverse(binary(prime(n)))) where prime(n) is the n-th prime.
a(n) = A030101(A000040(n)). - Rémy Sigrist, Oct 19 2022