A182248 a(0)=0, a(n) = (a(n-1) OR n) + n.
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
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Eric Weisstein's World of Mathematics, OR
- Wikipedia, Bitwise operation OR
Programs
-
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
-
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 *)
-
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 */
-
Python
a=0 for i in range(1,51): print(a, end=',') a |= i a += i
Formula
a(0)=0, a(n)=(a(n-1) OR n) + n, where OR is the bitwise logical inclusive-OR operator.