OFFSET
1,2
COMMENTS
Here "neighbor" primes are just paired in order: 2<->3, 5<->7, 11<->13, etc. Self-inverse permutation of the integers. Multiplicative.
LINKS
FORMULA
Sum_{k=1..n} a(k) ~ c * n^2, where c = (1/2) * Product_{p prime} (p^2-p)/(p^2-q(p)) = 0.9229142333..., where q(p) is the "neighbor" of p. - Amiram Eldar, Nov 29 2022
EXAMPLE
a(60) = 126 since 60 = 2^2*3*5, swapping 2<->3 and 5<->7 gives 3^2*2*7 = 126 (and of course then a(126) = 60).
MAPLE
p:= proc(n) option remember; `if`(numtheory[pi](n)::odd,
nextprime(n), prevprime(n))
end:
a:= n-> mul(p(i[1])^i[2], i=ifactors(n)[2]):
seq(a(n), n=1..80); # Alois P. Heinz, Sep 13 2017
MATHEMATICA
p[n_] := p[n] = If[OddQ[PrimePi[n]], NextPrime[n], NextPrime[n, -1]];
a[1] = 1; a[n_] := Product[p[i[[1]]]^i[[2]], {i, FactorInteger[n]}];
Array[a, 80] (* Jean-François Alcover, Jun 10 2018, after Alois P. Heinz *)
PROG
(PARI) a(n) = my(f=factor(n)); for (i=1, #f~, ip = primepi(f[i, 1]); if (ip % 2, f[i, 1] = prime(ip+1), f[i, 1] = prime(ip-1))); factorback(f); \\ Michel Marcus, Jun 09 2014
CROSSREFS
KEYWORD
AUTHOR
Marc LeBrun, May 14 2001
STATUS
approved