OFFSET
1,4
FORMULA
a(n) = 1/2 * Sum_{i=0..n-1} d(n-i, i+1) where, if m = Sum_{k} p_k^e^k, and n = Sum_{k} p_k^f^k, then d(m, n) = Sum_{i=1..k} abs(e_i - f_i), the multiplicative distance between m and n.
EXAMPLE
d(3, 1) = 1
d(2, 2) = 0
d(1, 3) = 1
So a(3) = 1/2 * (1 + 0 + 1) = 1
MATHEMATICA
MultDistance[m_, n_] := Module[{ mfac = FactorInteger[m], nfac = FactorInteger[ n]}, Plus @@ Map[(If[Length[ # ] == 1, #[[1, 2]], Abs[ #[[1, 2]] - #[[2, 2]]]]) &, Split[ Sort[Flatten[{mfac, nfac}, 1]], (#1[[1]] == #2[[1]]) &]]] DiagSum[n_] := 1/2 Sum[MultDistance[n - i, i + 1], {i, 0, n - 1}] Table[DiagSum[j], {j, 1, 1000}]
PROG
(PARI) multDist(m, n) = {if (m==n, 0, my(f=vecsort(concat(factor(m)[, 1], factor(n)[, 1]), , 8)); sum(i=1, #f, abs(valuation(m, f[i])-valuation(n, f[i]))))};
a(n)={sum(i=0, (n-1)/2, multDist(n-i, i+1))}; \\ edited by Michel Marcus, Sep 20 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jacob Woolcutt (woolcutt(AT)gmail.com), Jul 21 2007
EXTENSIONS
Program and corrections by Charles R Greathouse IV, Sep 02 2009
Edited by Michel Marcus, Sep 20 2018
STATUS
approved