OFFSET
1,2
COMMENTS
15 of the first 16 terms happen to be prime. As terms increase, the preponderance of primes apparently decreases.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..6542
FORMULA
a(n) = decimal(reverse(binary(prime(n)))) where prime(n) is the n-th prime.
EXAMPLE
a(14) = 53 because the 14th prime is 43, or 101011 binary; reverse of 101011 is 110101, or 53 decimal.
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 *)
PROG
(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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Gil Broussard, Oct 21 2004
STATUS
approved