Given a number n, check whether it’s prime number or not using recursion.
Input : n = 11 Output : Yes Input : n = 15 Output : No
The idea is based on school method to check for prime numbers.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Recursive sum of digits of a number is prime or not
- Recursive program to check if number is palindrome or not
- Recursive program to find all Indices of a Number
- Recursive Program to print multiplication table of a number
- Find coordinates of a prime number in a Prime Spiral
- Print the nearest prime number formed by adding prime numbers to N
- Check if a prime number can be expressed as sum of two Prime Numbers
- Count occurrences of a prime number in the prime factorization of every element from the given range
- Check if a number is Prime, Semi-Prime or Composite for very large numbers
- Recursive program to print formula for GCD of n integers
- Program to reverse a string (Iterative and Recursive)
- Recursive program to generate power set
- Recursive program to print all subsets with given sum
- Recursive program to insert a star between pair of identical characters
- Recursive Program for Binary to Decimal
- Recursive program to print all numbers less than N which consist of digits 1 or 3 only
- Recursive program to replace all occurrences of pi with 3.14 in a given string
- Recursive program to find the Sum of the series 1 - 1/2 + 1/3 - 1/4 ... 1/N
- Check if a number is magic (Recursive sum of digits is 1)
- Recursive sum of digits of a number formed by repeated appends
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.