Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6420 |

@blackshadows | 6376 |

@mb1973 | 5578 |

@Quandray | 5231 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4510 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3412 |

Complete Leaderboard | |

Handle | Score |

@codersgroup18 | 714 |

@Manikanta punnam | 579 |

@sriramgoparaju99 | 532 |

@yashkaril4 | 517 |

@praveenbgp6 | 517 |

@prankursharma31 | 489 |

@rdakka | 465 |

@sonamnigam1999 | 441 |

@purohitmn02 | 427 |

@sonamkumari63928 | 426 |

@ShubhankarPandey | 419 |

Complete Leaderboard |

Given a number **N**, the task is to find if **N** is Fibonacci-prime number or not. A Fibonacci-prime is any number that is both a prime and a Fibonacci number.

**Example 1:**

**Input:** N = "5"
**Output:** 1
**Explanation:** 5 is a Fibonacci number and
prime too

**Example 2:**

**Input:** N = "8"
**Output:** 0
**Explanation:** 8 is a Fibonacci number but,
not a prime.

**Your Task:**

You don't need to read input or print anything. Your task is to complete the function **fibonacciPrime() **which takes a string as inputs representing the number and **returns** 1 if the given number is a fibonacci-prime number, otherwise 0.

**Expected Time Complexity: **O(constant).

**Expected Auxiliary Space: **O(constant).

**Constraints:**

1 <= |N| <= 75

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
The Fibonacci-prime number

...