OFFSET
1,3
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^14, showing primes in red, composite prime powers in gold, even squarefree semiprimes in light green, other squarefree composites in dark green, and numbers neither squarefree nor prime powers in blue. Powerful numbers that are not prime powers are highlighted in light blue.
Neal Gersh Tolunsky, Graph of first 150000 terms.
FORMULA
sqrt(n)/2 <= a(n) <= 2*n*sqrt(n). - Yifan Xie, Oct 01 2023
EXAMPLE
n=3 has d(3) = 2 divisors (like all primes) and 3 is not divisible by 2, so we multiply: a(3) = 3*2 = 6.
n=8 has d(8) = 4 divisors and 8 is divisible by 4, so we divide: a(8) = 8/4 = 2.
MATHEMATICA
a[n_] := n * If[Divisible[n, d = DivisorSigma[0, n]], 1/d, d]; Array[a, 100] (* Amiram Eldar, Oct 01 2023 *)
PROG
(PARI) a(n) = my(d=numdiv(n)); if (n % d, n*d, n/d); \\ Michel Marcus, Oct 01 2023
(Python)
from sympy import divisor_count
def A366144(n): return n*d if (q:=divmod(n, d:=int(divisor_count(n))))[1] else q[0] # Chai Wah Wu, Oct 02 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Neal Gersh Tolunsky, Sep 30 2023
STATUS
approved