Arithmetic Sequence!
Description:
Introduction
A sequence is usually a set or an array of numbers that has a strict way for moving from the nth term to the (n+1)th term.
If f(n) = f(n-1) + c
where c
is a constant value, then f
is an arithmetic sequence.
An example would be (where the first term is 0 and the constant is 1) is [0, 1, 2, 3, 4, 5, ... and so on]
Else if f(n) = f(n-1) * c
where c
is a constant value, then f
is a geometric sequence.
Example where the first term is 2 and the constant is 2 will be [2, 4, 8, 16, 32, 64, ... to infinity ... ]
There are some other sequences that aren't arithmetic nor are they geometric.
Here is a link to feed your brain! : Sequence
Task
You're going to write a function that's going to return the value in the nth index of an arithmetic sequence. (That is, adding a constant to move to the next element in the "sequence").
The function takes three inputs first
,n
,c
where:
first
is the first value in the index0
.n
is the index of the value we want.c
is the constant added between each term.
Remember that first
is in the index 0
.. just saying ...
Similar Kata:
Stats:
Created | Sep 9, 2014 |
Published | Sep 17, 2014 |
Warriors Trained | 12282 |
Total Skips | 1271 |
Total Code Submissions | 14134 |
Total Times Completed | 7529 |
JavaScript Completions | 1843 |
Ruby Completions | 1129 |
CoffeeScript Completions | 170 |
Python Completions | 2216 |
Haskell Completions | 723 |
Java Completions | 1835 |
Clojure Completions | 345 |
C# Completions | 162 |
NASM Completions | 30 |
C Completions | 151 |
Total Stars | 73 |
% of votes with a positive feedback rating | 83% of 599 |
Total "Very Satisfied" Votes | 436 |
Total "Somewhat Satisfied" Votes | 125 |
Total "Not Satisfied" Votes | 38 |
Total Rank Assessments | 12 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |