Given a number N, the task is to check if its first and last digit is a prime number and their sum is less than K, or not. If it is, then print Yes, else print No.
Input: N = 322223, K = 10 Output: Yes Input: N = 62531561, K = 15 Output: No
- Check if the first and last digit of N is prime or not.
- If they are prime, then check if they are less than K or not
- If they are less than K as well, print Yes.
- In any other case, print No.
Below is the implementation of the above approach:
- Check if the first and last digit of the smallest number forms a prime
- Min steps to convert N-digit prime number into another by replacing a digit in each step
- Check if a number is Prime, Semi-Prime or Composite for very large numbers
- Check if a prime number can be expressed as sum of two Prime Numbers
- Queries for the smallest and the largest prime number of given digit
- Largest number less than N whose each digit is prime number
- Find all numbers between range L to R such that sum of digit and sum of square of digit is prime
- Check if the product of digit sum and its reverse equals the number or not
- Check whether a number can be expressed as a product of single digit numbers
- Check if N is a Balanced Prime number or not
- Check whether the given number is Wagstaff prime or not
- Check whether a number is circular prime or not
- Check if a number is Full Prime
- Check if a number is a Pythagorean Prime or not
- Check if a number is Quartan Prime or not
- Check whether a number is Good prime or not
- C Program to Check Whether a Number is Prime or not
- Check if a number is Primorial Prime or not
- Check if N is a Weak Prime number or not
- Check whether N is a Dihedral Prime Number or not
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.