0

Hpw to generate a fibonacci series and prime numbers .which generate like 1,1,1,2,2,3,3,5,....

odd position contains Fibonacci and even position contains prime numbers

1st Sep 2018, 11:21 AM
Nithya R
3 Answers
+ 3
Nithya apply same logic of normal Fibonacci and just change index & index +1 as index & index +2... same to be done for storing prime nunbers
1st Sep 2018, 11:25 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 3
Nithya If I understood it correctly, then you mean that print those numbers which are prime in Fibonacci series?
1st Sep 2018, 9:09 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
Also 1 is not prime :p
1st Sep 2018, 11:38 AM
Dan Walker
Dan Walker - avatar