login
A050096
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
1, 8, 2, 16, 5, 40, 13, 4, 32, 10, 3, 24, 192, 64, 21, 7, 56, 18, 6, 48, 384, 128, 42, 14, 112, 37, 12, 96, 768, 256, 85, 28, 9, 72, 576, 4608, 1536, 512, 170, 1360, 453, 151, 50, 400, 133, 44, 352, 117, 39, 312, 104, 34, 11, 88, 29, 232
OFFSET
1,2
LINKS
MATHEMATICA
Rest@Nest[Append[#, If[FreeQ[#, r = Quotient[#[[-1]], 3]], r, 8 #[[-1]]]] &, {0, 1}, 55] (* Ivan Neretin, Jul 31 2016 *)
PROG
(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
CROSSREFS
Cf. A050000 and references therein.
Sequence in context: A040063 A196170 A164587 * A161593 A008866 A180728
KEYWORD
nonn
STATUS
approved