login
a(n) = floor(a(n-1)/3) if this is positive and not yet in the sequence, otherwise a(n) = 8*a(n-1).
5

%I #12 Oct 05 2019 18:22:16

%S 1,8,2,16,5,40,13,4,32,10,3,24,192,64,21,7,56,18,6,48,384,128,42,14,

%T 112,37,12,96,768,256,85,28,9,72,576,4608,1536,512,170,1360,453,151,

%U 50,400,133,44,352,117,39,312,104,34,11,88,29,232

%N a(n) = floor(a(n-1)/3) if this is positive and not yet in the sequence, otherwise a(n) = 8*a(n-1).

%H Ivan Neretin, <a href="/A050096/b050096.txt">Table of n, a(n) for n = 1..10000</a>

%t Rest@Nest[Append[#, If[FreeQ[#, r = Quotient[#[[-1]], 3]], r, 8 #[[-1]]]] &, {0, 1}, 55] (* _Ivan Neretin_, Jul 31 2016 *)

%o (PARI) first(n)=my(v=vector(n),t); v[1]=1; for(i=2,n, t=v[i-1]\3; if(t<2, v[i]=8*v[i-1]; next); for(j=1,i-1, if(v[j]==t, v[i]=8*v[i-1]; next(2))); v[i]=t); v \\ _Charles R Greathouse IV_, Jul 31 2016

%Y Cf. A050000 and references therein.

%K nonn

%O 1,2

%A _Clark Kimberling_