OFFSET
1,2
LINKS
EXAMPLE
14 is in the sequence because its ternary representation is 112;
15 is not in the sequence because its ternary representation is 120.
MAPLE
a:=proc(n) local nn, L: nn:=convert(n, base, 3): L:=nops(nn): if nn[L]=1 and 0 < product(nn[j], j=1..L) then n else end if end proc: seq(a(n), n=1..500); # Emeric Deutsch, Sep 09 2007
MATHEMATICA
Flatten[Table[FromDigits[Join[{1}, #], 3]&/@Tuples[{1, 2}, n], {n, 0, 5}]] (* Harvey P. Dale, Jan 28 2015 *)
PROG
(Haskell)
a132140 n = a132140_list !! (n-1)
a132140_list = filter f [1..] where
f x = x < 3 && x == 1 || t > 0 && f x' where (x', t) = divMod x 3
-- Reinhard Zumkeller, Feb 06 2015
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Reinhard Zumkeller, Aug 20 2007
STATUS
approved