login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A183209 Tree generated by floor(3n/2): a(1) = 1, a(2n) = (3*a(n))-1, a(2n+1) = floor((3*a(n+1))/2). 8

%I #42 Mar 30 2021 09:37:33

%S 1,2,3,5,4,8,7,14,6,11,12,23,10,20,21,41,9,17,16,32,18,35,34,68,15,29,

%T 30,59,31,62,61,122,13,26,25,50,24,47,48,95,27,53,52,104,51,101,102,

%U 203,22,44,43,86,45,89,88,176,46,92,93,185,91,182,183,365,19,38,39,77,37

%N Tree generated by floor(3n/2): a(1) = 1, a(2n) = (3*a(n))-1, a(2n+1) = floor((3*a(n+1))/2).

%C A permutation of the positive integers. See the comment at A183079. Leftmost branch of tree is essentially A061418. Rightmost: A007051.

%H Antti Karttunen, <a href="/A183209/b183209.txt">Table of n, a(n) for n = 1..8192; the first 14 levels of the tree, flattened</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F Let L(n)=floor(3n/2).

%F Let U(n)=3n-1. U is the complement of L.

%F The tree-array T(n,k) is then given by rows:

%F T(0,0)=1; T(1,0)=2;

%F T(n,2j)=L(T(n-1),j);

%F T(n,2j+1)=U(T(n-1),j);

%F for j=0,1,...,2^(n-1)-1, n>=2.

%F From _Antti Karttunen_, Jan 26 2015: (Start)

%F a(1) = 1, a(2n) = (3*a(n))-1, a(2n+1) = A032766(a(n+1)) = floor((3*a(n+1))/2).

%F Other identities:

%F a(2^n) = A007051(n) for all n >= 0. [A property shared with A048673 and A254103.]

%F (End)

%e First levels of the tree:

%e 1

%e 2

%e 3 5

%e 4 8 7 14

%p f:= proc(n) option remember;

%p if n::even then 3*procname(n/2)-1

%p else floor(3*procname((n+1)/2)/2)

%p fi

%p end proc:

%p f(1):= 1:

%p seq(f(n), n=1..100); # _Robert Israel_, Jan 26 2015

%t a[1]=1; a[n_] := a[n] = If[EvenQ[n], 3a[n/2]-1, Floor[3a[(n+1)/2]/2] ]; Array[a, 100] (* _Jean-François Alcover_, Feb 02 2018 *)

%o (Scheme, with memoizing macro definec)

%o (definec (A183209 n) (cond ((<= n 1) n) ((even? n) (A016789 (- (A183209 (/ n 2)) 1))) (else (A032766 (A183209 (/ (+ n 1) 2))))))

%o ;; _Antti Karttunen_, Jan 26 2015

%o (Haskell)

%o import Data.List (transpose)

%o a183209 n k = a183209_tabf !! (n-1) !! (k-1)

%o a183209_row n = a183209_tabf !! (n-1)

%o a183209_tabf = [1] : iterate (\xs -> concat $

%o transpose [map a032766 xs, map (a016789 . subtract 1) xs]) [2]

%o a183209_list = concat a183209_tabf

%o -- _Reinhard Zumkeller_, Jun 27 2015

%o (Python)

%o def a(n):

%o if n==1: return 1

%o if n%2==0: return 3*a(n//2) - 1

%o else: return (3*a((n - 1)//2 + 1))//2

%o print([a(n) for n in range(1, 101)]) # _Indranil Ghosh_, Jun 06 2017

%Y Cf. A183079, A007051, A016789, A183207, A183208, A032766, A191450.

%Y Similar permutations: A048673, A254103.

%Y Inverse permutation: A259431.

%K nonn,tabf,look

%O 1,2

%A _Clark Kimberling_, Dec 30 2010

%E Formula to the name-field added by _Antti Karttunen_, Jan 26 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 06:30 EDT 2024. Contains 371919 sequences. (Running on oeis4.)