OFFSET
1,6
COMMENTS
A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i. Of course, the alternating sum of prime indices is also the reverse-alternating sum of reversed prime indices.
Also the number of possible values of A056239(d) where d is a divisor of n with half as many prime factors (rounded up) as n.
EXAMPLE
Grouping the 12 permutations of {1,2,2,3} by alternating sum k gives:
k = -2: (1223) (1322) (2213) (2312)
k = 0: (1232) (2123) (2321) (3212)
k = 2: (2132) (2231) (3122) (3221)
so a(90) = 3.
MATHEMATICA
primeMS[n_]:=If[n==1, {}, Flatten[Cases[FactorInteger[n], {p_, k_}:>Table[PrimePi[p], {k}]]]];
ats[y_]:=Sum[(-1)^(i-1)*y[[i]], {i, Length[y]}];
Table[Length[Union[ats/@Permutations[primeMS[n]]]], {n, 100}]
PROG
(Python)
from sympy import factorint, primepi
from sympy.utilities.iterables import multiset_combinations
def A345926(n):
fs = dict((primepi(a), b) for (a, b) in factorint(n).items())
return len(set(sum(d) for d in multiset_combinations(fs, (sum(fs.values())+1)//2))) # Chai Wah Wu, Aug 23 2021
CROSSREFS
The version for prime factors instead of indices is A343943.
A000005 counts divisors.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A345197 counts compositions by length and alternating sum.
A344610 counts partitions by sum and positive reverse-alternating sum.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jul 14 2021
STATUS
approved