Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider $n = p_{1}^{a_1}\cdots p_{r}^{a_{r}}$. An integer $d = p_{i}^{b_{i}} \cdots p_{r}^{b^{r}}$ is called an exponential divisor of $n$ if $b_{i}$ divides $a_{i}$ for every $1\leq i \leq r.$

I am trying to encode two functions: $\tau'(n)$, the number of exponential divisors of $n$, and $\sigma'(n)$, the sum of the exponential divisors of $n$.

Both $\tau'$ and $\sigma'$ are multiplicative, hence we only need to look at them on prime powers. For example

$\sigma'(p^6) = p + p^2 + p^3 + p^6$,


$\tau'(p^6) = 4$.

I have been having difficulty in using Mathematica to encode an expression for $\tau'$ and $\sigma'$. I do not really understand what 'heads' and 'levels' mean. Does anyone have any suggestions?

share|improve this question

Here's a fairly straightforward implementation.

sigmaPrime[n_] := Apply[Times, Total[#[[1]]^Divisors[#[[2]]]] & /@ FactorInteger[n]]
tauPrime[n_] := Apply[Times, DivisorSigma[0, #[[2]]] & /@ FactorInteger[n]]

sigmaPrime[2^3 3^2 5^6 7]
(* 13255200 *)

tauPrime[2^3 3^2 5^6 7]
(* 16 *)
share|improve this answer
sig[n_] := 
 Times @@ MapThread[Total[#1^Divisors[#2]] &, 
tau[n_] := 
 Times @@ MapThread[Length[Divisors[#2]] &, 

These are really trivial variants of MichaelE2 (now that I have read his answer).

Testing (unsuprisingly):

sig[2^3 3^2 5^6 7]


(* 13255200 *)


tau[2^3 3^2 5^6 7]

yields 16.

share|improve this answer
Many thanks! These work well. – Tim Trudgian Dec 17 '13 at 0:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.