Summing in Mathematica.

  • #1
MathematicalPhysicist
Gold Member
4,699
369
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,327
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
Bill Simpson
1,071
31
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
 

Suggested for: Summing in Mathematica.

Replies
1
Views
186
Replies
6
Views
410
Replies
0
Views
144
Replies
5
Views
532
Replies
1
Views
203
Replies
1
Views
635
  • Last Post
Replies
1
Views
535
Replies
2
Views
244
  • Last Post
Replies
5
Views
258
  • Last Post
Replies
3
Views
48
Top