SHARE
TWEET

Untitled

a guest Apr 24th, 2013 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. primes = []
  2. for i in range(10 ** 4, 10 ** 5):
  3.       if str(i) == str(i)[::-1]:
  4.           prime = True
  5.           for j in range(2, int(i ** 0.5) + 1):
  6.               if i % j == 0:
  7.                   prime = False
  8.                   break
  9.           if prime:
  10.               primes.append(i)
  11. print("There are " + str(len(primes)) + " palindromic primes of 5-digits:");
  12. print(str(primes).strip("[]"))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top