OFFSET
0,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Eric Weisstein's World of Mathematics, OR
Wikipedia, Bitwise operation OR
FORMULA
a(0)=0, a(n)=(a(n-1) OR n) + n, where OR is the bitwise logical inclusive-OR operator.
MATHEMATICA
nxt[{n_, a_}]:={n+1, BitOr[a, n+1]+n+1}; NestList[nxt, {0, 0}, 50][[All, 2]] (* Harvey P. Dale, Jun 01 2020 *)
PROG
(Python)
a=0
for i in range(1, 51):
print(a, end=', ')
a |= i
a += i
(Haskell)
import Data.Bits ((.|.))
a182248 n = a182248_list !! n
a182248_list = map fst $ iterate f (0, 1) where
f (y, x) = ((x .|. y) + x, x + 1) :: (Integer, Integer)
-- Reinhard Zumkeller, Apr 23 2012
(Maxima)
load(functs)$
A182248[0]:0$
A182248[n]:=logor(a[n-1], n) + n$
makelist(A182248[n], n, 0, 30); /* Martin Ettl, Nov 01 2012 */
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Alex Ratushnyak, Apr 20 2012
STATUS
approved