|
EXAMPLE
|
Divisors of 24 are 1, 2, 3, 4, 6, 8, 12, 24. Unitary divisors are 1, 3, 8, 24 and their sum is 36. Bi-unitary divisors are 1, 2, 3, 4, 6, 8, 12, 24 and their sum is 60. Then 60 - 36 = 24.
Divisors of 240 are 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 30, 40, 48, 60, 80, 120, 240. Unitary divisors are 1, 3, 5, 15, 16, 48, 80, 240 and their sum is 408. Bi-unitary divisors are 1, 2, 3, 5, 6, 8, 10, 15, 16, 24, 30, 40, 48, 80, 120, 240 and their sum is 648. Then 648 - 408 = 240.
|
|
MAPLE
|
Q:=proc(n) local a, e, p, f; a:=1 ; for f in ifactors(n)[2] do e:=op(2, f); p:=op(1, f);
if type(e, odd) then a:=a*(p^(e+1)-1)/(p-1); else a:=a*((p^(e+1)-1)/(p-1)-p^(e/2)); fi; od: a ; end:
P:=proc(h) local a, b, k, n;
for n from 1 to h do a:=divisors(n); b:=0;
for k from 1 to nops(a) do if gcd(a[k], n/a[k])=1 then b:=b+a[k]; fi; od;
if Q(n)-b=n then print(n); fi; od; end: P(10^6);
|
|
PROG
|
(PARI) up(p, e) = p^e+1;
bup(p, e) = my(ret = (p^(e+1) - 1)/(p-1)); if ((e % 2) == 0, ret -= p^(e/2)); ret;
isok(n) = f = factor(n); n == (prod(k=1, #f~, bup(f[k, 1], f[k, 2])) - prod(k=1, #f~, up(f[k, 1], f[k, 2]))); \\ Michel Marcus, Oct 05 2014
|