# How to generate a series with recurrence relation? [closed]

I am a beginner in Mathematica and stuck on a problem. I want to generate a series using a recurrence relation, however, I am facing the problem while feeding previous values.

b == 1
b[n+1] == b[n] + n/x^n


I need the following result,

b + b + b + b .....

• Did you try anything? You'll get more answers if you show some effort from your side. Also, try to search (this site, google, and the documentation center) for a solution to your problem. Very rarely are you the first to face a particular issue ;) – Lukas Lang Jun 1 '18 at 11:14
• – kglr Jun 1 '18 at 11:15
• If you're looking for the infinite sum, it's divergent, at least for $x > 0$. Proof: $b_{n} > b_{n-1}$ by the recurrence relation, which means $b_n > b_0 = 1$ for all $n$. – Michael Seifert Jun 1 '18 at 12:47
• (I'm pretty sure that the sum of the series diverges for $x < 0$ as well, but I haven't been able to find a similarly simple proof.) – Michael Seifert Jun 1 '18 at 13:04
• What have you tried? – Daniel Lichtblau Jun 1 '18 at 15:44

Total@RecurrenceTable[{b[n + 1] == b[n] + n/x^n, b == 1}, b, {n, 0, 10}]


$\frac{9}{x^9}+\frac{16}{x^8}+\frac{21}{x^7}+\frac{24}{x^6}+\frac{25}{x^5}+\frac{24}{x^4}+\frac{21}{x^3}+\frac{16}{x^2}+\frac{9}{x}+11$

Another way:

sol = RSolve[{b[n + 1] == b[n] + n/x^n, b == 1}, b[n], n]


$\left\{\left\{b(n)\to \frac{x^{-n} \left(-x+n x-n x^2+x^n-x^{1+n}+x^{2+n}\right)}{(-1+x)^2}\right\}\right\}$

Total@Table[b[n] /. sol[], {n, 0, 10}] // FullSimplify // Expand


give the same answer what is above.