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.

Showing 1-4 of 4 results.

A182243 a(0)=0, a(n) = (a(n-1) AND n) + n.

Original entry on oeis.org

0, 1, 2, 5, 8, 5, 10, 9, 16, 9, 18, 13, 24, 21, 18, 17, 32, 17, 34, 21, 40, 21, 42, 25, 48, 41, 34, 29, 56, 53, 50, 49, 64, 33, 66, 37, 72, 37, 74, 41, 80, 41, 82, 45, 88, 53, 82, 49, 96, 81, 66, 53, 104, 85, 74, 57, 112, 105, 98, 93, 88, 85, 82, 81, 128, 65
Offset: 0

Views

Author

Alex Ratushnyak, Apr 20 2012

Keywords

Crossrefs

Cf. A182242.

Programs

  • 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
  • Mathematica
    Join[{t = 0}, Table[t = BitAnd[t, n] + n, {n, 100}]] (* T. D. Noe, Apr 21 2012 *)
  • Python
    a=0
    for i in range(1,511):
        print(a, end=',')
        a &= i
        a += i
    

Formula

a(0) = 0, a(n) = (a(n-1) AND n) + n, where AND is the bitwise logical AND operator.

A182389 a(0)=1, a(n) = (a(n-1) + n) XOR n.

Original entry on oeis.org

1, 3, 7, 9, 9, 11, 23, 25, 41, 59, 79, 81, 81, 83, 111, 113, 145, 179, 215, 249, 281, 315, 327, 329, 377, 395, 447, 449, 449, 451, 511, 513, 513, 515, 519, 521, 521, 523, 535, 537, 617, 699, 719, 721, 721, 723, 815, 881, 913, 1011, 1047, 1145, 1177, 1275, 1287
Offset: 0

Views

Author

Alex Ratushnyak, Apr 27 2012

Keywords

Comments

a(n) >= n.
a(n) >= a(n-1). - Daniel Leary, Aug 21 2016

Examples

			a(5) = (a(4)+5) XOR 5 = (9+5) XOR 5 = 14 XOR 5 = 11.
		

Crossrefs

Programs

  • Mathematica
    Module[{n = 0}, NestList[BitXor[++n, # + n] &, 1, 100]] (* Paolo Xausa, Nov 26 2024 *)
  • Python
    a=1
    for i in range(1,55):
        print(a, end=',')
        a += i
        a ^= i

Formula

a(0)=1, a(n)=(a(n-1) + n) XOR n, where XOR is the bitwise exclusive-OR operator.

A237054 a(1)=1, a(n) = (a(n-1) + n) XOR n.

Original entry on oeis.org

1, 1, 7, 15, 17, 17, 31, 47, 49, 49, 55, 79, 81, 81, 111, 111, 145, 177, 215, 255, 257, 257, 271, 319, 321, 321, 327, 383, 385, 385, 447, 511, 513, 513, 519, 527, 529, 529, 543, 623, 689, 753, 823, 847, 849, 849, 943, 1007, 1041, 1137, 1175, 1279, 1281, 1281
Offset: 1

Views

Author

Alex Ratushnyak, Feb 03 2014

Keywords

Crossrefs

Programs

  • Mathematica
    Module[{n = 1}, NestList[BitXor[++n, # + n] &, 1, 100]] (* Paolo Xausa, Nov 26 2024 *)
  • Python
    a=1
    for n in range(2, 77):
      print(a, end=', ')
      a = (a+n) ^ n

Formula

a(1)=1, then a(n) = (a(n-1) + n) XOR n, where XOR is the bitwise exclusive-OR operator.

A330581 a(0) = 2; thereafter a(n) = a(n - 1)^n + 1.

Original entry on oeis.org

2, 3, 10, 1001, 1004006004002, 1020191144865623440455270145683555422808365843606721760320033
Offset: 0

Views

Author

David Johnson-Davies, Dec 18 2019

Keywords

Comments

Note that this could be extended backwards to a(-1), and any nonzero value x for a(-1) would work, since x^0 + 1 = 2.

Crossrefs

Programs

  • Lisp
    (defun a (n) (+ (if (zerop n) 1 (expt (a (- n 1)) n)) 1))
    
  • Maple
    a:= proc(n) option remember; `if`(n<0, %,
          1 + a(n-1)^n)
        end:
    seq(a(n), n=0..5);  # Alois P. Heinz, Dec 18 2019
  • Mathematica
    a[0] = 2; a[n_] := a[n] = a[n - 1]^n + 1; Array[a, 6, 0] (* Amiram Eldar, Dec 19 2019 *)
    nxt[{n_,a_}]:={n+1,a^(n+1)+1}; NestList[nxt,{0,2},5][[;;,2]] (* Harvey P. Dale, Dec 10 2023 *)
  • PARI
    a(n) = if(n==0, 2, a(n-1)^n+1) \\ Felix Fröhlich, Dec 18 2019

Extensions

Edited by N. J. A. Sloane, Dec 27 2019
Showing 1-4 of 4 results.