Prime number
Practice
0 (0 votes)
Open
Open
Medium
Math basic
Basic math
Mathematics
Open
Math
Problem
23% Success 86 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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

Input format
Only line of input consists of a single integer denoting \(n\)

Output format
Print the required answer.

Constraints
\(1 \le Number \; of \; digits \; in \; n \le 10^{5} \)
No leading zeroes are available 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:50
2 votes
Tags:
Data StructuresApprovedMedium-HardBinary search algorithmData Structures
Points:20
176 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen
711 votes