OFFSET
1,2
COMMENTS
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
Multiplicative: if e = Sum_{k>=1} d_k * k! (factorial base representation), then a(p^e) = Product_{k>=1} (p^(k!*{d_k+1}) - 1)/(p^(k!) - 1).
EXAMPLE
For n = 12 = 2^2 * 3^1, the representation of 2 in factorial base is 10, i.e., 2 = 2!, so 12 = (2^(2!))^1 * (3^(1!))^1 and a(12) is the sum of the 4 divisors 1 + 3 + 4 + 12 = 20.
MATHEMATICA
ff[q_, s_] := (q^(s + 1) - 1)/(q - 1); f[p_, e_] := Module[{k = e, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0 || r != 0, If[r > 0, AppendTo[s, {p^(m - 1)!, r}]; ]; m++]; Times @@ ff @@@ s]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100]
PROG
(PARI) fdigits(n) = {my(k = n, m = 2, r, s = []); while([k, r] = divrem(k, m); k != 0 || r != 0, s = concat(s, r); m++); s; }
a(n) = {my(f = factor(n), p = f[, 1], e = f[, 2], d); prod(i = 1, #p, prod(j = 1, #d=fdigits(e[i]), (p[i]^(j!*(d[j]+1)) - 1)/(p[i]^j! - 1))); }
CROSSREFS
KEYWORD
nonn,easy,mult,base
AUTHOR
Amiram Eldar, Oct 08 2024
STATUS
approved