login
a(n) = n/d(n) if d(n) | n, otherwise a(n) = n*d(n), where d(n) = A000005(n) is the number of divisors of n.
2

%I #30 Oct 02 2023 15:25:47

%S 1,1,6,12,10,24,14,2,3,40,22,2,26,56,60,80,34,3,38,120,84,88,46,3,75,

%T 104,108,168,58,240,62,192,132,136,140,4,74,152,156,5,82,336,86,264,

%U 270,184,94,480,147,300,204,312,106,432,220,7,228,232,118,5,122,248,378,448,260,528,134

%N a(n) = n/d(n) if d(n) | n, otherwise a(n) = n*d(n), where d(n) = A000005(n) is the number of divisors of n.

%H Michael De Vlieger, <a href="/A366144/b366144.txt">Table of n, a(n) for n = 1..10000</a>

%H Michael De Vlieger, <a href="/A366144/a366144_1.png">Log log scatterplot of a(n)</a>, 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.

%H Neal Gersh Tolunsky, <a href="/A366144/a366144.png">Graph of first 150000 terms</a>.

%F sqrt(n)/2 <= a(n) <= 2*n*sqrt(n). - _Yifan Xie_, Oct 01 2023

%e 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.

%e n=8 has d(8) = 4 divisors and 8 is divisible by 4, so we divide: a(8) = 8/4 = 2.

%t a[n_] := n * If[Divisible[n, d = DivisorSigma[0, n]], 1/d, d]; Array[a, 100] (* _Amiram Eldar_, Oct 01 2023 *)

%o (PARI) a(n) = my(d=numdiv(n)); if (n % d, n*d, n/d); \\ _Michel Marcus_, Oct 01 2023

%o (Python)

%o from sympy import divisor_count

%o 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

%Y Cf. A000005, A038040, A033950, A036762.

%Y Cf. A366067 (iterate starting 578).

%K nonn,easy

%O 1,3

%A _Neal Gersh Tolunsky_, Sep 30 2023