\[ S = 1 + 4 + 7 + 11 +... + 100 \]
sum(seq(1 , 100, 3))
## [1] 1717
\[ S = 1^{2020} + 2^{2020} + 3^{2020} +...+2020^{2020} \]
sum((c(1:2020)^2020))
## [1] Inf
\[ S = \frac{1}{1\cdot 2}+\frac{1}{2 \cdot 3}+...+\frac{1}{2020\cdot 2021} \]
x <- c(1:2020)
y <- c(2:2021)
sum(1/(x*y))
## [1] 0.9995052
\[ S = \frac{1}{1\cdot 2 \cdot 3}+\frac{1}{2 \cdot 3 \cdot 4}+...+\frac{1}{2020\cdot 2021 \cdot 2022} \]
z <- c(3:2022)
sum(1/(x*y*z))
## Warning in x * y * z: NAs produced by integer overflow
## [1] NA
\[ S = 1^1 + 3^3 + 5^5 + 7^7 +....+2021^{2021} \]
s <- seq(1, 2021, 2)
sum(s^s)
## [1] Inf