cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A182248 a(0)=0, a(n) = (a(n-1) OR n) + n.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Apr 20 2012

Keywords

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.