login
Successively add the smallest ternary number that is not a substring.
5

%I #9 Feb 06 2022 06:49:55

%S 1,3,5,8,9,11,15,18,19,22,25,28,30,32,36,38,43,46,49,52,55,58,61,64,

%T 68,71,74,75,79,82,84,86,90,92,96,100,104,108,110,115,120,122,125,128,

%U 131,134,137,140,143,146,150,153,156,160,163,166,169,172,176,179

%N Successively add the smallest ternary number that is not a substring.

%H Reinhard Zumkeller, <a href="/A261786/b261786.txt">Table of n, a(n) for n = 1..10000</a>

%o (Haskell)

%o a261786 n = a261786_list !! (n-1)

%o a261786_list = iterate (\x -> x + a261787 x) 1

%o (PARI) ts(n) = Str(fromdigits(digits(n, 3))); \\ A007089

%o f(n) = my(s=ts(n), k=1); while (#strsplit(s, ts(k)) != 1, k++); k; \\ A261787

%o lista(nn) = my(v = vector(nn)); v[1] = 1; for (n=2, nn, v[n] = v[n-1] + f(v[n-1]);); v; \\ _Michel Marcus_, Feb 06 2022

%Y Cf. A007089, A261787, A261789 (first differences), A261788, A260273, A261793.

%K nonn,base

%O 1,2

%A _Reinhard Zumkeller_, Sep 01 2015