std::vector<uint64_t>
N_bonacci(
constuint64_t &n,
constuint64_t &m) {
41std::vector<uint64_t> a(
43 if(m < n || n == 0) {
54 for(uint64_t i = n + 1; i < m; i++) {
58a[i] = 2 * a[i - 1] - a[i - 1 - n];
73 conststd::vector<uint64_t> expected;
74 TestCase(
constuint64_t in_n,
constuint64_t in_m,
75std::initializer_list<uint64_t>
data)
76: n(in_n), m(in_m), expected(
data) {
77assert(
data.size() == m);
80 conststd::vector<TestCase> test_cases = {
88 TestCase(5, 15, {0, 0, 0, 0, 1, 1, 2, 4, 8, 16, 31, 61, 120, 236, 464}),
91{0, 0, 0, 0, 0, 1, 1, 2, 4, 8, 16, 32, 63, 125, 248, 492, 976}),
92 TestCase(56, 15, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};
94 for(
const auto&tc : test_cases) {
97std::cout <<
"passed"<< std::endl;
std::vector< uint64_t > N_bonacci(const uint64_t &n, const uint64_t &m)
Finds the N-Bonacci series for the n parameter value and m parameter terms.
static void test()
Self-test implementations.
int main()
Main function.
Functions for the N-bonacci implementation.
represents single example inputs and expected output of the function longest_common_string_length
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4