6 kyu
Backwards Read Primes
277 of 7,429g964
Description:
Backwards Read Primes are primes that when read backwards in base 10 (from right to left) are a different prime. (This rules out primes which are palindromes.)
Examples:
13 17 31 37 71 73 are Backwards Read Primes
13 is such because it's prime and read from right to left writes 31 which is prime too. Same for the others.
Task
Find all Backwards Read Primes between two positive given numbers (both inclusive), the second one always being greater than or equal to the first one. The resulting array or the resulting string will be ordered following the natural order of the prime numbers.
Examples (in general form):
backwardsPrime(2, 100) => [13, 17, 31, 37, 71, 73, 79, 97] backwardsPrime(9900, 10000) => [9923, 9931, 9941, 9967] backwardsPrime(501, 599) => []
See "Sample Tests" for your language.
Notes
- Forth Return only the first backwards-read prime between start and end or 0 if you don't find any
- Ruby Don't use Ruby Prime class, it's disabled.
Mathematics
Algorithms
Similar Kata:
Stats:
Created | Apr 24, 2015 |
Published | Apr 24, 2015 |
Warriors Trained | 25906 |
Total Skips | 5489 |
Total Code Submissions | 56599 |
Total Times Completed | 7429 |
Ruby Completions | 277 |
Python Completions | 1483 |
Clojure Completions | 87 |
Haskell Completions | 84 |
JavaScript Completions | 1213 |
C# Completions | 472 |
Java Completions | 1307 |
CoffeeScript Completions | 23 |
C++ Completions | 549 |
PHP Completions | 277 |
Crystal Completions | 13 |
F# Completions | 36 |
C Completions | 207 |
TypeScript Completions | 219 |
Rust Completions | 254 |
Swift Completions | 266 |
R Completions | 57 |
Shell Completions | 52 |
OCaml Completions | 41 |
Scala Completions | 170 |
Kotlin Completions | 256 |
Elixir Completions | 59 |
NASM Completions | 8 |
Julia Completions | 36 |
PowerShell Completions | 46 |
Go Completions | 243 |
Nim Completions | 15 |
Racket Completions | 17 |
Forth Completions | 9 |
Prolog Completions | 13 |
Fortran Completions | 7 |
Pascal Completions | 12 |
Raku Completions | 10 |
Perl Completions | 18 |
Elm Completions | 4 |
D Completions | 5 |
Total Stars | 422 |
% of votes with a positive feedback rating | 89% of 1208 |
Total "Very Satisfied" Votes | 966 |
Total "Somewhat Satisfied" Votes | 209 |
Total "Not Satisfied" Votes | 33 |