OFFSET
1,1
COMMENTS
From R. J. Mathar, Mar 03 2009: (Start)
If we look at the sequence first differences, i.e.,
2, 4, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 82, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, we obtain the records in A034472. (End)
The lower and upper asymptotic densities of this sequence are 1/4 and 1/2, respectively. - Amiram Eldar, Feb 28 2021
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
A number k is a term if and only if 2*3^m <= k <= 3^(m+1)-1, for m=0,1,2,...
A171960(a(n)) < a(n). - Reinhard Zumkeller, Jan 20 2010
MAPLE
for n from 1 to 300 do dgs := convert(n, base, 3) ; if op(-1, dgs) = 2 then printf("%d, ", n) ; fi; od: # R. J. Mathar, Mar 03 2009
MATHEMATICA
Flatten[(Range[2*3^#, 3^(#+1)-1])&/@Range[0, 4]]
Select[Range[200], First[IntegerDigits[#, 3]]==2&] (* Harvey P. Dale, Oct 16 2012 *)
Table[FromDigits[#, 3]&/@(Join[{2}, #]&/@Tuples[{0, 1, 2}, n]), {n, 0, 4}]// Flatten (* Harvey P. Dale, Jan 28 2022 *)
PROG
(PARI) s=[]; for(n=0, 4, for(x=3^n, 2*3^n-1, s=concat(s, x))); s
(Haskell)
a157671 n = a157671_list !! (n-1)
a157671_list = filter ((== 2) . until (< 3) (flip div 3)) [1..]
-- Reinhard Zumkeller, Feb 06 2015
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Zak Seidov, Mar 04 2009
STATUS
approved