Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

PRPALIN - Editorial

$
0
0

PROBLEM LINK:

Practice

Author:ADMIN

Editorialist:SUSHANT AGARWAL

DIFFICULTY:

SIMPLE

PREREQUISITES:

Basic looping,Conditional statements

PROBLEM:

You will be given an integer N, 1 ≤ N ≤ 1000000. You must find the smallest integer M ≥ N such that M is a prime number and M is a palindrome.

EXPLANATION:

Check every odd number after N (using a loop) for 2 properties

1)It should be prime 2) The number should be equal to its reverse.

Print the first number that satisfies these 2 properties and then break out of the loop when this number is encountered.

EDITORIALIST'S SOLUTION:

Editorialist's solution can be found here.


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>