OFFSET
1,1
COMMENTS
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A036044(prime(n)). - Michel Marcus, Apr 22 2015
EXAMPLE
37->100101->change digits 011010->read from right to left 010110->22 281->100011001->change digits 011100110->read from right to left 011001110->206
MAPLE
P:=proc(i) local a, b, j, k, n; for n from 1 by 1 to i do a:=convert(ithprime(n), binary); j:=length(a); b:=convert(a, string); k:=""; while j>0 do if substring(b, j)="1" then k:=cat(k, "0"); else k:=cat(k, "1"); fi; j:=j-1; od; a:=convert(k, decimal, binary); print(a); od; end: P(100);
MATHEMATICA
FromDigits[Reverse@ BitNot@ IntegerDigits[#, 2] + 2, 2] & /@ Prime@ Range@ 71 (* Michael De Vlieger, Apr 22 2015 *)
PROG
(PARI) a(n)=fromdigits(Vecrev(apply(n->1-n, binary(prime(n)))), 2) \\ Charles R Greathouse IV, Apr 22 2015
(Python)
from sympy import prime
def A159006(n): return -int((s:=bin(prime(n))[-1:1:-1]), 2)-1+2**len(s) # Chai Wah Wu, Feb 04 2022
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Paolo P. Lava & Giorgio Balzarotti, Apr 02 2009
EXTENSIONS
Edited by R. J. Mathar, Apr 06 2009
STATUS
approved