Related: Calculate Power Series Coefficients
Given a positive integer \$X\$ and a max exponent (Also a positive integer too) \$N\$ calculate the result of a power series. Example:
$$X^0+X^1+X^2+\cdots +X^N$$
- Assume \$(X + N) \le 100\$
Test Cases
1 2 => 3
2 3 => 15
3 4 => 121
2 19 => 1048575
Standard code-golf rules apply.
n*n-1
rather thann
. Since my vote hammers, I'll wait for others to say if this is dupe-worthy. \$\endgroup\$0
to be neither positive nor negative. A couple of places (like France) don't consider positive to mean strictly positive, and treat0
as both positive and negative. \$\endgroup\$