Advertisement
andreahmed

Untitled

Dec 3rd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. 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.)
  2.  
  3. Examples:
  4. 13 17 31 37 71 73 are Backwards Read Primes
  5. 13 is such because it's prime and read from right to left writes 31 which is prime too. Same for the others.
  6.  
  7. Task
  8.  
  9. Find all Backwards Read Primes between two positive given numbers (both inclusive), the second one being greater than the first one. The resulting array or the resulting string will be ordered following the natural order of the prime numbers.
  10.  
  11. backwardsPrime(2, 100) => "13 17 31 37 71 73 79 97"
  12. backwardsPrime(9900, 10000) => "9923 9931 9941 9967
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement