For a certain sequence of numbers, the sum of the first $n$ numbers in the sequence is given by $n^3+4n$ for all positive integers $n$. What is the fifteenth number in the sequence?
How do you solve this problem the most efficient way?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityFor a certain sequence of numbers, the sum of the first $n$ numbers in the sequence is given by $n^3+4n$ for all positive integers $n$. What is the fifteenth number in the sequence?
How do you solve this problem the most efficient way?
Solve[Table[Sum[f[i], {i, 1, n}] == n^3 + 4 n, {n, 15}], Array[f, 15]]
(*
{{f[1] -> 5, f[2] -> 11, f[3] -> 23, f[4] -> 41, f[5] -> 65,
f[6] -> 95, f[7] -> 131, f[8] -> 173, f[9] -> 221, f[10] -> 275,
f[11] -> 335, f[12] -> 401, f[13] -> 473, f[14] -> 551,
f[15] -> 635}}
*)
Differences[Table[n^3 + 4 n, {n, 0, 15}]]
, but that requires a step of reasoning first.
$\endgroup$
Oct 9, 2015 at 4:20
(FindSequenceFunction@ Differences[Prepend[n^3 + 4 n /. n -> Range@10, 0]])@15
(* 635 *)
Might as well...
DifferenceDelta[n^3 + 4 n, n] /. n -> 15 - 1
Let $S_n=\sum^n_{j=1}a_n$. So $a_n=S_n-S_{n-1}$.
5 - 3 n + 3 n^2 /. n -> 15
yields 635. (Mathematica can obviously do this).
DifferenceDelta[]
does, made explicit.
$\endgroup$
Oct 9, 2015 at 8:15
DifferenceDelta
. I am happy to delete and acknowledge all the answers get to the same result. :)
$\endgroup$
s(15)-s(14)
$\endgroup$