login
A224512
Gray code variant of A147582.
2
1, 4, 12, 4, 12, 36, 12, 4, 12, 36, 108, 36, 12, 36, 12, 4, 12, 36, 108, 36, 108, 324, 108, 36, 12, 36, 108, 36, 12, 36, 12, 4, 12, 36, 108, 36, 108, 324, 108, 36, 108, 324, 972, 324, 108, 324, 108, 36, 12, 36, 108, 36, 108, 324, 108, 36, 12, 36, 108
OFFSET
1,2
COMMENTS
A147582 is generated by using the binary weight of n, A000120 = wt().
Here instead, A224512 uses the Gray code weight, A005811 = gt().
FORMULA
a(1) = 1. For a(n)>1, a(n) = 4 * 3^(gt(n-1)-1).
EXAMPLE
A003188(5-1) = 6 = 110 (base 2), so gt(5-1) = 2. Then a(5) = 12 = 4 * 3^1 = 12.
PROG
(PARI) gt(n) = sum(kk=1, n, (-1)^((kk/2^valuation(kk, 2)-1)/2)); \\ from A005811.
a(n) = if (n==1, 1, 4 * 3^(gt(n-1)-1)); \\ Michel Marcus, Apr 22 2013
CROSSREFS
Sequence in context: A307874 A230057 A205124 * A010296 A084351 A286682
KEYWORD
nonn
AUTHOR
Gary W. Adamson, Apr 08 2013
STATUS
approved