OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = 2 * ((n-1) XOR n) = 2*A038712(n).
a(n) = 4*2^A007814(n) - 2.
Recurrence: a(2n) = 2a(n) + 2, a(2n+1) = 2. - Ralf Stephan, Aug 21 2013
a(n) = A088837(n) - 1. - Filip Zaludek, Dec 10 2016
MATHEMATICA
a[n_]:=BitXor[2*n-1, 2*n+1]; a/@Range[100] (* Ivan N. Ianakiev, Jul 04 2019 *)
PROG
(PARI) a(n)=4*2^valuation(n, 2)-2; \\ Ralf Stephan, Aug 21 2013
(Haskell)
a100892 n = (2 * n - 1) `xor` (2 * n + 1)
a100892_list = zipWith xor (tail a005408_list) a005408_list
-- Reinhard Zumkeller, Sep 03 2013
(Python)
def A100892(n): return ((~n& n-1)<<2)+2 # Chai Wah Wu, Jul 07 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 10 2005
STATUS
approved