OFFSET
0,3
LINKS
FORMULA
MATHEMATICA
A[n_]:=2*n - DigitCount[2*n, 2, 1]; Table[BitOr[n, A[Floor[n/2]]], {n, 0, 100}] (* Indranil Ghosh, Mar 25 2017 *)
PROG
(Scheme) (define (A283996 n) (A003986bi n (A005187 (floor->exact (/ n 2))))) ;; Where A003986bi implements bitwise-OR (A003986).
(PARI) b(n) = if(n<1, 0, b(n\2) + n%2);
A(n) = 2*n - b(2*n);
for(n=0, 100, print1(bitor(n, A(floor(n/2))), ", ")) \\ Indranil Ghosh, Mar 25 2017
(Python)
def A(n): return 2*n - bin(2*n)[2:].count("1")
print([n|A(n//2) for n in range(101)]) # Indranil Ghosh, Mar 25 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Mar 19 2017
STATUS
approved