id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

simona1@sfusd.edu > n_bonacci
prev  |  next  |  chance

The Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, 21, 34...) can be called the 2bonacci sequence. The 3bonacci sequence is 1, 1, 1, 3, 5, 9, 17, 31, 57, 105, 193, 355, 653, 1201...and the 4bonacci sequence is 1, 1, 1, 1, 4, 7, 13, 25, 49, 94, 181, 349, 673... Complete the n_bonacci function that returns the n_bonacci number in position p of the sequence. The first number of the sequence is in position 0.


n_bonacci(2, 5) → 8
n_bonacci(3, 3) → 3
n_bonacci(3, 9) → 105

...Save, Compile, Run (ctrl-enter)

public int n_bonacci(int n, int p) }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy