OFFSET
0,3
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..8192=2^13
Eric Weisstein's World of Mathematics, AND
Wikipedia, Bitwise operation AND
FORMULA
a(0) = 0, a(n) = (a(n-1) AND n) + n, where AND is the bitwise logical AND operator.
MATHEMATICA
Join[{t = 0}, Table[t = BitAnd[t, n] + n, {n, 100}]] (* T. D. Noe, Apr 21 2012 *)
PROG
(Python)
a=0
for i in range(1, 511):
print(a, end=', ')
a &= i
a += i
(Haskell)
import Data.Bits ((.&.))
a182243 n = a182243_list !! n
a182243_list = map fst $ iterate f (0, 1) where
f (y, x) = ((x .&. y) + x, x + 1) :: (Integer, Integer)
-- Reinhard Zumkeller, Apr 23 2012
CROSSREFS
KEYWORD
AUTHOR
Alex Ratushnyak, Apr 20 2012
STATUS
approved