6 kyu
Pure odd digits primes
383 of 1,038raulbc777
Description:
Primes that have only odd digits are pure odd digits primes, obvious but necessary definition. Examples of pure odd digit primes are: 11, 13, 17, 19, 31... If a prime has only one even digit does not belong to pure odd digits prime, no matter the amount of odd digits that may have.
Create a function, only_oddDigPrimes(), that receive any positive integer n, and output a list like the one below:
[number pure odd digit primes below n, largest pure odd digit prime smaller than n, smallest pure odd digit prime higher than n]
Let's see some cases:
only_oddDigPrimes(20) ----> [7, 19, 31]
///7, beacause we have seven pure odd digit primes below 20 and are 3, 5, 7, 11, 13, 17, 19
19, because is the nearest prime of this type to 20
31, is the first pure odd digit that we encounter after 20///
only_oddDigPrimes(40) ----> [9, 37, 53]
In the case that n, the given value, is a pure odd prime, should be counted with the found primes and search for the immediately below and the immediately after.
Happy coding!!
Fundamentals
Algorithms
Mathematics
Data Structures
Similar Kata:
Stats:
Created | Aug 28, 2015 |
Published | Aug 28, 2015 |
Warriors Trained | 3075 |
Total Skips | 320 |
Total Code Submissions | 5349 |
Total Times Completed | 1038 |
Python Completions | 383 |
Ruby Completions | 72 |
JavaScript Completions | 260 |
Java Completions | 147 |
CoffeeScript Completions | 6 |
C# Completions | 82 |
Haskell Completions | 35 |
Clojure Completions | 11 |
C++ Completions | 57 |
C Completions | 60 |
Total Stars | 74 |
% of votes with a positive feedback rating | 92% of 256 |
Total "Very Satisfied" Votes | 217 |
Total "Somewhat Satisfied" Votes | 35 |
Total "Not Satisfied" Votes | 4 |