A345926 Number of distinct possible alternating sums of permutations of the multiset of prime indices of n.
1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 2, 3, 1, 2, 2, 2, 1, 3, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 4, 1, 2, 2, 1, 2, 3, 1, 2, 2, 3, 1, 3, 1, 2, 2, 2, 2, 3, 1, 2, 1, 2, 1, 4, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 1, 2, 2, 3
Offset: 1
Keywords
Examples
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.
Crossrefs
Programs
-
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}]
-
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
Comments