Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def divisors(num):
- count = 1
- div = 2
- while (div < num):
- if (num % div == 0):
- count = count + 1
- div = div + 1
- return count
- x = 4
- prime_numbers = []
- while (x <= 100):
- result = divisors(x)
- if (result == 1):
- prime_numbers = prime_numbers + [x]
- x = x + 1
- y = 2
- prime_number_divisible = False
- while (y <= 100):
- for x in prime_numbers:
- if (y % x == 0):
- prime_number_divisible = True
- if ((y % 2 == 0 or y % 3 == 0) and prime_number_divisible == False):
- print y, "is divisible by 2 or 3 but not by any other prime number"
- y = y + 1
- prime_number_divisible = False
Advertisement
Add Comment
Please, Sign In to add comment