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

Stats:

CreatedNov 17, 2016
PublishedNov 17, 2016
Warriors Trained3075
Total Skips570
Total Code Submissions5504
Total Times Completed907
Python Completions416
Ruby Completions104
JavaScript Completions229
Rust Completions24
Lua Completions19
Go Completions78
D Completions3
C++ Completions80
Total Stars86
% of votes with a positive feedback rating92% of 185
Total "Very Satisfied" Votes161
Total "Somewhat Satisfied" Votes20
Total "Not Satisfied" Votes4
Total Rank Assessments7
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • raulbc777 Avatar
  • anter69 Avatar
  • smile67 Avatar
  • stellartux Avatar
  • akar-0 Avatar
  • 66  Avatar
  • saudiGuy Avatar
Ad