6 kyu
Pentabonacci
785 of 2,189raulbc777
Description:
We have the following sequence:
f(0) = 0
f(1) = 1
f(2) = 1
f(3) = 2
f(4) = 4;
f(n) = f(n-1) + f(n-2) + f(n-3) + f(n-4) + f(n-5);
Your task is to give the number of total values for the odd terms of the sequence up to the n-th term (included). (The number n (of n-th term) will be given as a positive integer)
The values 1 (one) is the only that is duplicated in the sequence and should be counted only once.
E.g.
count_odd_pentaFib(5) -----> 1 # because the terms up to 5 are: 0, 1, 1, 2, 4, 8 (only 1 is odd and counted once)
Other examples:
count_odd_pentaFib(10) ------> 3 #because the odds terms are: [1, 1, 31, 61] (three different values)
count_odd_pentaFib(15) ------> 5 # beacause the odd terms are: [1, 1, 31, 61, 1793, 3525] (five different values)
Good luck !!
(Your code should be fast. Many moderate high values will be waiting to test it.)
Fundamentals
Mathematics
Algorithms
Performance
Dynamic Programming
Stats:
Created | Aug 10, 2015 |
Published | Aug 19, 2015 |
Warriors Trained | 5409 |
Total Skips | 661 |
Total Code Submissions | 11411 |
Total Times Completed | 2189 |
Python Completions | 785 |
Haskell Completions | 95 |
Ruby Completions | 74 |
JavaScript Completions | 358 |
CoffeeScript Completions | 12 |
Java Completions | 402 |
C# Completions | 193 |
Clojure Completions | 50 |
Elixir Completions | 116 |
Scala Completions | 43 |
Groovy Completions | 16 |
COBOL Completions | 7 |
C++ Completions | 129 |
Go Completions | 36 |
Rust Completions | 70 |
D Completions | 7 |
Total Stars | 109 |
% of votes with a positive feedback rating | 91% of 354 |
Total "Very Satisfied" Votes | 302 |
Total "Somewhat Satisfied" Votes | 37 |
Total "Not Satisfied" Votes | 15 |