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.

A180076 a(n+1) = if it exists, smallest number not occurring earlier that is contained in binary representation of a(n), otherwise: a(n+1) = 3*a(n)+1; a(0) = 0.

Original entry on oeis.org

0, 1, 4, 2, 7, 3, 10, 5, 16, 8, 25, 6, 19, 9, 28, 12, 37, 18, 55, 11, 34, 17, 52, 13, 40, 20, 61, 14, 43, 21, 64, 32, 97, 24, 73, 36, 109, 22, 67, 33, 100, 50, 151, 23, 70, 35, 106, 26, 79, 15, 46, 139, 69, 208, 80, 241, 30, 91, 27, 82, 41, 124, 31, 94, 47, 142, 71, 214, 53, 160
Offset: 0

Views

Author

Reinhard Zumkeller, Aug 14 2010

Keywords

Comments

Permutation of the natural numbers with inverse A180077;
if a(n-1) > a(n) then a(n) < a(n+1) = 3*a(n)+1;
see A180110 for m with a(m-2) < a(m-1) < a(m);
A180078(n) = a(a(n));
a(A180079(n)) = A180079(a(n)) = A180077(n);
A180080 and A180081 give record values and where they occur.

Crossrefs

Cf. A030308.
Cf. A062383.

Programs

  • Haskell
    import Data.List (delete)
    a180076 n = a180076_list !! n
    a180076_list :: [Integer]
    a180076_list = 0 : f 0 [1..] where
       f x zs = y : f y (delete y zs) where
         y = if null ys then 3 * x + 1 else head ys
         ys = [y | y <- takeWhile (< x) zs, binInfix y x]
       binInfix u v = ib v where
         ib w = w `mod` m == u || w > u && ib (w `div` 2)
         m = a062383 u
    -- Reinhard Zumkeller, Mar 13 2014, Feb 19 2013