Facebook
From Murat Kağan Temel, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 222
  1. prime(n):
  2.     If n <= 1, return False.
  3.     If n <= 3, return True.
  4.     If n%2 == 0 or n%3 == 0, return False.
  5.     Iterate from i = 5 to the sqrt(n):
  6.         If n%i == 0 or (n+2)% == 0, return False.
  7.     If none, return True.
  8.  
  9. find_prime_numbers():
  10.     Store prime numbers in a list.
  11.     Iterate over numbers from 500 to 600 -exclusive-:
  12.         If the first digit of the number is '5' and the number is prime, add it to the list.
  13.     Return the list.
  14.