Prime Digit Number
Practice
5 (2 votes)
Mathematics
Medium
Mathematics
Mathematics
Mathamatics
Problem
32% Success 6084 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given a large integer value n. Find the largest number x such that \(x \le n\) and all digits of x are prime.

Input:
Only line of input consists of a single integer denoting n.

Output:
Print the required answer.

Constraints:
\(1 \le Number \; of \; digits \; in \; n \le 10^{5} \)
There will be no leading zeroes in n.
\(n \ge 2\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
4 votes
Tags:
C++MathSortingBasic Math
Points:30
46 votes
Tags:
GeometryImplementationOpenAlgorithmsApprovedMedium
Points:30
Tags:
Medium