OFFSET
1,1
COMMENTS
A permutation of order 4 of the positive integers.
LINKS
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
KEYWORD
nonn,easy
AUTHOR
Robert Israel, Jun 30 2016
STATUS
approved