OFFSET
1,10
LINKS
FORMULA
EXAMPLE
For n = 1 the prime factorization is empty, thus there is nothing to sum, so a(1) = 0.
For n = 6 = 2*3 = prime(1) * prime(2), a(6) = 1 because the (absolute value of) difference between prime indices of 2 and 3 is 1.
For n = 10 = 2*5 = prime(1) * prime(3), a(10) = 2 because the difference between prime indices of 2 and 5 is 2.
For n = 12 = 2*2*3 = prime(1) * prime(1) * prime(2), a(12) = 2 because the difference between prime indices of 2 and 3 is 1, and the pair (2,3) occurs twice as one can pick either one of the two 2's present in the prime factorization to be a pair of a single 3. Note that the index difference between 2 and 2 is 0, thus the pair (2,2) of prime divisors does not contribute to the sum.
For n = 36 = 2*2*3*3, a(36) = 4 because the index difference between 2 and 3 is 1, and the prime factor pair (2,3) occurs 2^2 = four times in total. As the index difference is zero between 2 and 2 as well as between 3 and 3, the pairs (2,2) and (3,3) do not contribute to the sum.
MATHEMATICA
Table[Function[p, Total@ Map[Function[b, Times @@ {First@ Differences@ PrimePi@ b, Count[Subsets[p, {2}], c_ /; SameQ[c, b]]}], Subsets[Union@ p, {2}]]][Flatten@ Replace[FactorInteger@ n, {p_, e_} :> ConstantArray[p, e], 2]], {n, 120}] (* Michael De Vlieger, Mar 08 2017 *)
PROG
KEYWORD
nonn
AUTHOR
Antti Karttunen, Sep 23 2015
STATUS
approved