OFFSET
1,2
COMMENTS
Equivalently: If n = 2^x * 3^y * f with gcd(f, 2) * gcd(f, 3) = 1 and x, y >= 0 and f > 0, then: a(n) = 2^(x - x mod 2 + y mod 2) * 3^(y - y mod 2 + x mod 2) * f for n > 0.
A self-inverse permutation of the natural numbers, i.e., a(a(n)) = n for all n.
Multiplicative but not completely multiplicative (see formula).
FORMULA
Multiplicative with a(p^e) = p^e if e is even or p > 3, a(2^e) = 3 * 2^(e-1) and a(3^e) = 2 * 3^(e-1) if e is odd.
Let n = 2^(2*x+r) * 3^(2*y+s) * Product_{prime p > 3} p^z(p) with 0 <= r,s <= 1; then a(n) = 2^(2*x+s) * 3^(2*y+r) * Product_{prime p > 3} p^z(p); especially: a(n) = n * 2 / 3 if r < s, a(n) = n if r = s, and a(n) = n * 3 / 2 if r > s.
Sum_{k=1..n} a(k) ~ (77/144) * n^2. - Amiram Eldar, Nov 29 2022
EXAMPLE
n = 40320 = 2^(2*3+1)*3^(2*1+0)*5*7, then a(n) = 2^(2*3+0)*3^(2*1+1)*5*7 = 60480.
MAPLE
p := (n, k) -> modp(padic[ordp](n, k), 2): a := n -> n*(3/2)^(p(n, 2) - p(n, 3)):
seq(a(n), n = 1..74); # Peter Luschny, Oct 20 2022
MATHEMATICA
a[n_] := (3/2)^Differences[Mod[IntegerExponent[n, {3, 2}], 2]][[1]] * n; Array[a, 100] (* Amiram Eldar, Oct 20 2022 *)
PROG
(PARI) a(n) = my(x=valuation(n, 2), y=valuation(n, 3), f=n/2^x/3^y, x2=x%2, y2 = y%2); 2^(x - x2 + y2) * 3^(y - y2 + x2) * f; \\ Michel Marcus, Oct 19 2022
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
Werner Schulte, Oct 17 2022
STATUS
approved