%I #11 Jan 29 2022 20:14:39
%S 1,2,1,3,3,4,1,1,5,6,6,2,3,7,6,8,9,4,1,6,10,1,1,5,5,11,11,3,10,12,12,
%T 8,13,6,6,14,3,15,11,1,16,17,12,14,3,17,12,2,9,18,19,2,20,4,1,12,16,4,
%U 1,11,21,12,12,2,22,4,1,23,10,19,19,14,5,24,24,2,20,7,6,25,26,23,23,3,21,19,19,25,5,23,23,10,21,1,1,10,13,27,27,21,28,1,1
%N Restricted growth sequence transform of A304760(n), formed from 1-digits in ternary representation of A254103(n).
%H Antti Karttunen, <a href="/A304740/b304740.txt">Table of n, a(n) for n = 0..65537</a>
%o (PARI)
%o A254103(n) = if(!n,n,if(!(n%2),(3*A254103(n/2))-1,(3*(1+A254103((n-1)/2)))\2));
%o A289813(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==1, 1, 0)), 2); } \\ From A289813
%o A304760(n) = A289813(A254103(n));
%o rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
%o v304740 = rgs_transform(vector(65538,n,A304760(n-1)));
%o A304740(n) = v304740[1+n];
%Y Cf. A254103, A289813, A304760.
%Y Cf. also A304746.
%K nonn,look
%O 0,2
%A _Antti Karttunen_, May 29 2018