Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # paulogp
- # prime numbers
- def is_prime(the_n):
- if (the_n == 1):
- print("1 is special")
- return False
- for the_x in range(2, the_n):
- if (the_n % the_x == 0):
- print("{} equals {} x {}".format(the_n, the_x, the_n // the_x))
- return False
- else:
- print("{} is a prime number".format(the_n))
- return True
- # first 30 numbers
- for the_n in range(1, 30):
- is_prime(the_n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement