OFFSET
1,2
COMMENTS
The lower and upper asymptotic densities of this sequence are 1/2 and 3/4, respectively. - Amiram Eldar, Feb 28 2021
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Bryan Brown, Michael Dairyko, Stephan Ramon Garcia, Bob Lutz and Michael Someck, Four quotient set gems, The American Mathematical Monthly, Vol. 121, No. 7 (2014), pp. 590-598; arXiv preprint, arXiv:1312.1036 [math.NT], 2013.
Christian Mauduit, Propriétés arithmétiques des substitutions, in Séminaire de Théorie des Nombres, Paris, 1989-90, pp. 177-190 (in French).
FORMULA
A number n is a term iff 3^m <= n < 2*3^m -1, for m=0,1,2,... - Zak Seidov, Mar 03 2009
a(n) = n + (3^floor(log_3(2*n)) - 1)/2. - Kevin Ryde, Feb 19 2022
MATHEMATICA
Flatten[(Range[3^#, 2 3^#-1])&/@Range[0, 4]] (* Zak Seidov, Mar 03 2009 *)
PROG
(PARI) s=[]; for(n=0, 4, for(x=3^n, 2*3^n-1, s=concat(s, x))); s \\ Zak Seidov, Mar 03 2009
(PARI) a(n) = n + 3^logint(n<<1, 3) >> 1; \\ Kevin Ryde, Feb 19 2022
(Haskell)
a132141 n = a132141_list !! (n-1)
a132141_list = filter ((== 1) . until (< 3) (flip div 3)) [1..]
-- Reinhard Zumkeller, Feb 06 2015
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Reinhard Zumkeller, Aug 20 2007
STATUS
approved