login
A182248
a(0)=0, a(n) = (a(n-1) OR n) + n.
2
0, 2, 4, 10, 18, 28, 36, 46, 54, 72, 84, 106, 122, 140, 156, 174, 206, 240, 260, 298, 338, 364, 404, 430, 470, 504, 532, 570, 602, 636, 668, 702, 734, 800, 836, 906, 978, 1052, 1124, 1166, 1238, 1320, 1364, 1450, 1498, 1580
OFFSET
0,2
LINKS
Eric Weisstein's World of Mathematics, 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
Sequence in context: A005541 A375625 A045955 * A093695 A308529 A320098
KEYWORD
base,nonn
AUTHOR
Alex Ratushnyak, Apr 20 2012
STATUS
approved