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.

A096116 a(1)=1, if n=(2^k)+1, a(n) = k+2, otherwise a(n) = 2+A000523(n-1)+a(2+A035327(n-1)).

Original entry on oeis.org

1, 2, 3, 5, 4, 9, 7, 6, 5, 11, 12, 14, 9, 10, 8, 7, 6, 13, 14, 16, 15, 20, 18, 17, 11, 12, 13, 15, 10, 11, 9, 8, 7, 15, 16, 18, 17, 22, 20, 19, 18, 24, 25, 27, 22, 23, 21, 20, 13, 14, 15, 17, 16, 21, 19, 18, 12, 13, 14, 16, 11, 12, 10, 9, 8, 17, 18, 20, 19, 24, 22, 21, 20, 26
Offset: 1

Views

Author

Amarnath Murthy, Jun 30 2004

Keywords

Comments

Each n > 1 occurs A025147(n) times in the sequence.

Crossrefs

Programs

  • Mathematica
    a = {1}; Do[AppendTo[a, If[BitAnd[n - 1, n - 2] == 0, Log2[n - 1] + 2, 2 + Floor[Log2[n - 1]] + a[[2 + BitXor[n - 1, 2^Ceiling[Log2[n]] - 1]]]]], {n, 2, 74}]; a (* Ivan Neretin, Jun 24 2016 *)
  • Scheme
    (define (A096116 n) (cond ((= 1 n) 1) ((pow2? (- n 1)) (+ 2 (A000523 (- n 1)))) (else (+ 2 (A000523 (- n 1)) (A096116 (+ 2 (A035327 (- n 1))))))))
    (define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1)))))
    ;; Antti Karttunen, Aug 25 2006

Extensions

Edited and extended by Antti Karttunen, Aug 25 2006