Computer Science, asked by jayvikram501, 4 months ago

Write a program to generate series 1 0 1 1 0 1 0 1 0 1 in php

Answers

Answered by lunalovegoodsahalala
0
The Tribonacci Sequence :
0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705, 3136, 5768, 10609, 19513, 35890, 66012, 121415, 223317, 410744, 755476, 1389537, 2555757, 4700770, 8646064, 15902591, 29249425, 53798080, 98950096, 181997601, 334745777, 615693474, 1132436852… so on

General Form of Tribonacci number:

a(n) = a(n-1) + a(n-2) + a(n-3)
with
a(0) = a(1) = 0, a(2) = 1.
Given a value N, task is to print first N Tribonacci Numbers.
Examples :

Input : 5
Output : 0, 0, 1, 1, 2

Input : 10
Output : 0, 0, 1, 1, 2, 4, 7, 13, 24, 44

Input : 20
Output : 0, 0, 1, 1, 2, 4, 7, 13, 24, 44,
81, 149, 274, 504, 927, 1705, 3136,
5768, 10609, 19513
Recommended: Please try your approach on {IDE} first, before moving on to the solution.

Similar questions