Summing in Mathematica.

  • #1
MathematicalPhysicist
Gold Member
4,285
200

Main Question or Discussion Point

I want to write down summation of the type
[tex]\sum_{d|n , d<n}[/tex] or [tex]\sum_{d|n}[/tex] both summing over d.
and d|n means d divides n.

I know that I can use Sum[term, {i, n-1}] but I don't know how to use this condition of divisibility to the summation.
any help?

Thanks.
 

Answers and Replies

  • #2
EnumaElish
Science Advisor
Homework Helper
2,304
124
You need to define term as a function of d and n such that "term = 0 unless d|n." Look into modulus arithmetic commands.
 
  • #3
1,069
29
In[1]:= n=12; Sum[If[Mod[n,d]==0,a^d,0],{d,n-1}]

Out[1]= a + a^2 + a^3 + a^4 + a^6
 

Related Threads on Summing in Mathematica.

Replies
5
Views
3K
Replies
2
Views
3K
  • Last Post
Replies
6
Views
739
  • Last Post
Replies
4
Views
732
Replies
0
Views
4K
Replies
1
Views
3K
Replies
9
Views
7K
Replies
25
Views
8K
Replies
3
Views
3K
Top