5 kyu
Primes with Even Digits
416 of 907raulbc777
Description:
Find the closest prime number under a certain integer n
that has the maximum possible amount of even digits.
For n = 1000
, the highest prime under 1000
is 887
, having two even digits (8 twice)
Naming f()
, the function that gives that prime, the above case and others will be like the following below.
f(1000) ---> 887 (even digits: 8, 8)
f(1210) ---> 1201 (even digits: 2, 0)
f(10000) ---> 8887
f(500) ---> 487
f(487) ---> 467
Features of the random tests:
Number of tests = 28
1000 <= n <= 5000000
Enjoy it!!
Strings
Data Structures
Algorithms
Mathematics
Number Theory
Similar Kata:
Stats:
Created | Nov 17, 2016 |
Published | Nov 17, 2016 |
Warriors Trained | 3075 |
Total Skips | 570 |
Total Code Submissions | 5504 |
Total Times Completed | 907 |
Python Completions | 416 |
Ruby Completions | 104 |
JavaScript Completions | 229 |
Rust Completions | 24 |
Lua Completions | 19 |
Go Completions | 78 |
D Completions | 3 |
C++ Completions | 80 |
Total Stars | 86 |
% of votes with a positive feedback rating | 92% of 185 |
Total "Very Satisfied" Votes | 161 |
Total "Somewhat Satisfied" Votes | 20 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 7 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |