login
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.
8
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,3
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.
PROG
(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
CROSSREFS
Cf. A030308.
Cf. A062383.
Sequence in context: A319556 A225126 A123684 * A169756 A329796 A002949
KEYWORD
base,nonn
AUTHOR
Reinhard Zumkeller, Aug 14 2010
STATUS
approved