login
A132140
Numbers containing no zeros in ternary representation and with an initial 1.
5
1, 4, 5, 13, 14, 16, 17, 40, 41, 43, 44, 49, 50, 52, 53, 121, 122, 124, 125, 130, 131, 133, 134, 148, 149, 151, 152, 157, 158, 160, 161, 364, 365, 367, 368, 373, 374, 376, 377, 391, 392, 394, 395, 400, 401, 403, 404, 445, 446, 448, 449, 454, 455, 457, 458, 472
OFFSET
1,2
COMMENTS
Intersection of A032924 and A132141;
A132138(A132139(a(n))) = 1.
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