Try this:
N = 20
counter = 0
for a in range(1, N):
if a%2 and a%3 and a%5:
counter += 1
The result will be in counter
at the end of the loop. Or for a fancier version, adapted from @iCodez's answer:
sum(1 for x in range(1, N) if all((x%2, x%3, x%5)))
=> 6