login
A274611
a(n) = n/8 if A007814(n) == 3 (mod 4), else a(n) = 2*n.
1
2, 4, 6, 8, 10, 12, 14, 1, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 3, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 5, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 7, 114, 116, 118, 120, 122, 124
OFFSET
1,1
COMMENTS
A permutation of order 4 of the positive integers.
FORMULA
a(16*k) = 16*a(k).
a(16*k + 8) = 2*k + 1.
a(n) = 2*n otherwise.
G.f. g(x) satisfies g(x) = 16*g(x^16) + 2*x/(1-x)^2 - x^8*(15 + 32*x^8 + 15* x^16)/(1-x^16)^2.
Sum_{k=1..n} a(k) ~ (15/16) * n^2. - Amiram Eldar, Aug 24 2024
MAPLE
f:= proc(n) option remember; local r;
r:= n mod 16;
if r = 0 then 16*procname(n/16)
elif r = 8 then n/8
else 2*n
fi
end proc:
map(f, [$1..100]);
MATHEMATICA
Table[If[Mod[IntegerExponent[n, 2], 4] == 3, n/8, 2 n], {n, 62}] (* Michael De Vlieger, Jun 30 2016 *)
PROG
(PARI) a(n) = if(valuation(n, 2) % 4 == 3, n/8, 2*n); \\ Amiram Eldar, Aug 24 2024
CROSSREFS
Cf. A007814.
Sequence in context: A285591 A327210 A376603 * A319808 A055956 A161207
KEYWORD
nonn,easy
AUTHOR
Robert Israel, Jun 30 2016
STATUS
approved