Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Find the Nth term in given Fibonacci and prime number mixture serie.

Home > Programs > Array

203 / 23

In the below given series:

1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, ...

This series is a mixture of 2 series - all the odd terms in this series form a Fibonacci series and all the even terms are the prime numbers in ascending order.

Write a program to find the Nth term in this series.
The value N is a Positive integer that should be read from STDIN. The Nth term that is calculated by the program should be written to STDOUT. Other than the value of Nth term, no other characters/strings or message should be written to STDOUT.

For example, when N = 14, the 14th term in the series is 17. So only the value 17 should be printed to STDOUT.

Show Full Paragraph


Asked In :: TCS NQT Wipro NLTH

Post Your Answer Here: