OFFSET
1,2
LINKS
FORMULA
Multiplicative with a(p) = (if p<=3 then 5-p else (if p+2 is prime then p+2 else (if p-2 is prime then p-2 else p))), p prime.
a(a(n)) = n, self-inverse permutation of natural numbers.
Sum_{k=1..n} a(k) ~ c * n^2 / 2, where c = Product_{(p < q) swapped pair} ((p^2-p)*(q^2-q)/((p^2-q)*(q^2-p))) = 1.832194438922717... . - Amiram Eldar, Feb 26 2024
EXAMPLE
a(143) = a(11*13) = a(11)*a(13) = 13*11 = 143.
a(77) = a(7*11) = a(7)*a(11) = 5*13 = 65.
MATHEMATICA
f[p_, e_] := If[p < 5, 5 - p, If[PrimeQ[p + 2], p + 2, If[PrimeQ[p - 2], p - 2, p]]]^e; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Feb 26 2024 *)
PROG
(PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, p = f[i, 1]; if(p < 5, 5-p, if(isprime(p+2), p+2, if(isprime(p-2), p-2, p)))^f[i, 2]); } \\ Amiram Eldar, Feb 26 2024
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Reinhard Zumkeller, Jun 07 2002
STATUS
approved