A120880 G.f. satisfies: A(x) = A(x^3)*(1 + 2*x + x^2); thus a(n) = 2^A062756(n), where A062756(n) is the number of 1's in the ternary expansion of n.
1, 2, 1, 2, 4, 2, 1, 2, 1, 2, 4, 2, 4, 8, 4, 2, 4, 2, 1, 2, 1, 2, 4, 2, 1, 2, 1, 2, 4, 2, 4, 8, 4, 2, 4, 2, 4, 8, 4, 8, 16, 8, 4, 8, 4, 2, 4, 2, 4, 8, 4, 2, 4, 2, 1, 2, 1, 2, 4, 2, 1, 2, 1, 2, 4, 2, 4, 8, 4, 2, 4, 2, 1, 2, 1, 2, 4, 2, 1, 2, 1, 2, 4, 2, 4, 8, 4, 2, 4, 2, 4, 8, 4, 8, 16, 8, 4, 8, 4, 2, 4, 2, 4, 8, 4
Offset: 0
Examples
Records are 2^n at positions: 0,1,4,13,40,121,...,(3^n-1)/2,... (n>=0). A(x) = 1 + 2*x + x^2 + 2*x^3 + 4*x^4 + 2*x^5 + x^6 + 2*x^7 + x^8 +...
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Andy Liu, Solution to Problem 2, Crux Mathematicorum, 17 (1991), 5-6.
Programs
-
Haskell
a120880 n = sum $ map (a039966 . (n -)) $ takeWhile (<= n) a005836_list -- Reinhard Zumkeller, Jan 28 2012
-
Mathematica
Nest[ Join[#, 2 #, #] &, {1}, 5] (* Robert G. Wilson v, Jul 27 2014 *)
-
PARI
a(n)=if(n==0,1,a(n\3)*2^((n%3)%2))
Comments