6 kyu

Even Fibonacci Sum

273 of 3,264krillgar

Description:

Give the summation of all even numbers in a Fibonacci sequence up to, but not including, the number passed to your function. Or, in other words, sum all the even Fibonacci numbers that are lower than the given number n (n is not the nth element of Fibonacci sequence) without including n.

The Fibonacci sequence is a series of numbers where the next value is the addition of the previous two values. The series starts with 0 and 1:

0 1 1 2 3 5 8 13 21...

For example:

Kata.Fibonacci(0) // returns 0
Kata.Fibonacci(33) // returns 10
Kata.Fibonacci(25997544) // returns 19544084
fibonacci(0)==0
fibonacci(33)==10
fibonacci(25997544)==19544084
eve_fib(0)==0
eve_fib(33)==10
eve_fib(25997544)==19544084
eve_fib(0)==0
eve_fib(33)==10
eve_fib(25997544)==19544084
fibSum 0 -> 0
fibSum 33 -> 10
fibSum 25997544 -> 19544084
      fibSum 0 = 0
      fibSum 33 = 10
      fibSum 25997544 = 19544084
fibsum(0) == 0
fibsum(33) == 10
fibsum(25997544) == 19544084
even_fib(0)==0
even_fib(33)==10
even_fib(25997544)==19544084
fibonacci(0)==0
fibonacci(33)==10
fibonacci(25997544)==19544084
fibonacci(0)==0
fibonacci(33)==10
fibonacci(25997544)==19544084
Algorithms

Stats:

CreatedMay 29, 2015
PublishedMay 29, 2015
Warriors Trained7032
Total Skips384
Total Code Submissions13984
Total Times Completed3264
C# Completions273
JavaScript Completions1073
Ruby Completions116
Python Completions1201
COBOL Completions7
Haskell Completions55
Julia Completions19
C Completions169
Java Completions273
SQL Completions134
C++ Completions169
Total Stars97
% of votes with a positive feedback rating91% of 510
Total "Very Satisfied" Votes433
Total "Somewhat Satisfied" Votes64
Total "Not Satisfied" Votes13
Total Rank Assessments34
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • krillgar Avatar
  • GiacomoSorbi Avatar
  • suic Avatar
  • ParanoidUser Avatar
  • Chrono79 Avatar
  • JohanWiltink Avatar
  • rowcased Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • mauro-1 Avatar
  • dfhwze Avatar
  • 66  Avatar
  • rock_lee Avatar
Ad