Back
Close

Primonacci

Statement
<<Pure calculation problem>> Let's U_n be the n-th Fibonnaci number found as following: U_0 = 0 U_1 = 1 U_{n+2} = U_{n+1} + U_{n} Let's keep only the prime index of the sequence and let's call it Vn. For example : V_1 = U_2 V_2 = U_3 V_3 = U_5 V_4 = U_7 etc.. And now let's define the Primonnaci sequence : P_1 = V_1 P_2 = V_2 P_{n+2} = P_{n+1} + P_{n} + V_{n+2} The goal here is to find the n-th element.

Input description
An integer <<n>>, the index of the primonacci sequence <<P>> to find

Output description
The <<n-th>> element of primonnaci sequence <<P>>

Constraints
n >= 5

Game modes

Test cases
Test 1 Test
Input
5
Output
120

Validator 1 Validator
Input
5
Output
120

Test 2 Test
Input
10
Output
558279

Validator 2 Validator
Input
50
Output
481969572652144156774432698213753930218928965018

Test 3 Test
Input
100
Output
51637027539937571113186705088269287267839035040992508105076007569211621170288908346484387699896717367234970788339

Validator 3 Validator
Input
300
Output
8300637093317015798306484771488129680030556958281061235357341586888592770898002704112865831652427414416155434713085436748009768196003976243128568537178444603967777928503737015655256290455598573908685459901759552809940296240547343965649439942578669498074719490981088808919243833203009699459861940217896432540761740505442933809805592789565656564825050399017675760469487571513496621005008464250337449577047709468232448

Test 4 Test
Input
250
Output
3467172734113551955396467651877627218498308790091996209438190461356428192772763492704109709627399211110469383655956337261156403362530993178991812671765314908347447651147320623801957175330738099075357069305687647038473342176735721021107976582037919772279640653657481432293679113521083832527468307230649712782234393287172471607025503

Validator 4 Validator
Input
500
Output
88667691985722925271170413864975630481686226253188991779844422681704528053704861469467344182494117815538986360530518055824757530478606157545038683915399566349933321576461590987327777198537930075356092636456027272729912953152870975453554847411434488364165350905421479814770121241544428974002768061646978558109709971074226910215360055136108099901810940290038602479136306987519391041950300017551875112883097495332538509445715343308987898354341026003864518107033388701057686114890459750753145236325455330549321500096270968158705576070240206465541136456192776370522453905203481138161012977121110060940730513948390951475159155569806230986736331531219055980844052608650516175383574061699824453841416881911791012544159331532971637073446730753772868897270

Solution language

Solution

Stub generator input