the first n prime numbers

Solutions on MaxInterview for the first n prime numbers by the best coders in the world

showing results for - "the first n prime numbers"
María Alejandra
26 Oct 2017
1def prime_numbers(n):
2    i = 2
3    while i <= n + 1:
4        if i % i == 0 and i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 \
5                or i == 2 or i == 3 or i == 5 or i == 7:
6            print(i)
7            i = i + 1
8        else:
9            i = i + 1
10            n = n + 1
11
12
13prime_numbers(25)
14