OFFSET
1,1
COMMENTS
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = f(n+1, 0) with f(n, x) = if n=1 then A004086(x) else f(floor(n/2), 10*x + 2 + n mod 2). - Reinhard Zumkeller, Sep 06 2008
a(n) is Theta(n^(log_2 10)); there are about n^(log_10 2) members of this sequence up to n. - Charles R Greathouse IV, Mar 18 2010
MATHEMATICA
Flatten[Table[FromDigits[#, 10]&/@Tuples[{2, 3}, n], {n, 5}]] (* Vincenzo Librandi, May 27 2012 *)
PROG
(Magma) [n: n in [1..24000] | Set(Intseq(n)) subset {2, 3}]; // Vincenzo Librandi, May 27 2012
(Magma) [n eq 1 select 2 else IsOdd(n) select 10*Self(Floor(n/2))+2 else Self(n-1)+1: n in [1..40]]; // Bruno Berselli, May 27 2012
(Haskell)
a032810 = f 0 . (+ 1) where
f y 1 = a004086 y
f y x = f (10 * y + m + 2) x' where (x', m) = divMod x 2
-- Reinhard Zumkeller, Mar 18 2015
(PARI) A032810(n)=vector(#n=binary(n+1)[2..-1], i, 10^(#n-i))*n~+10^#n\9*2 \\ M. F. Hasler, Mar 26 2015
(Python)
def A032810(n): return int(bin(n+1)[3:])+(10**((n+1).bit_length()-1)-1<<1)//9 # Chai Wah Wu, Jul 15 2023
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved