7 kyu

Arithmetic Sequence!

1,843 of 7,529zenAndroid

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 index 0.
  • 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 ...

Mathematics
Fundamentals

More By Author:

Check out these other kata created by zenAndroid

Stats:

CreatedSep 9, 2014
PublishedSep 17, 2014
Warriors Trained12282
Total Skips1271
Total Code Submissions14134
Total Times Completed7529
JavaScript Completions1843
Ruby Completions1129
CoffeeScript Completions170
Python Completions2216
Haskell Completions723
Java Completions1835
Clojure Completions345
C# Completions162
NASM Completions30
C Completions151
Total Stars73
% of votes with a positive feedback rating83% of 599
Total "Very Satisfied" Votes436
Total "Somewhat Satisfied" Votes125
Total "Not Satisfied" Votes38
Total Rank Assessments12
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • zenAndroid Avatar
  • jhoffner Avatar
  • alchemy Avatar
  • xcthulhu Avatar
  • Ivan Diachenko Avatar
  • alifhaikal88 Avatar
  • Azuaron Avatar
  • user578387 Avatar
  • aweleshetu Avatar
  • Chrono79 Avatar
  • Voile Avatar
  • Souzooka Avatar
  • FArekkusu Avatar
  • uniapi Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad