<s>[INST] I would like to translate the following math formulas into an efficient programming formula. The problem is as follows: 

Find the first 10 prime numbers and print them.

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. 

The mathematical definition of prime number can be described the following way:

Let P be the proposition that a number p is prime. Then this proposition to each integer n can be equivalently expressed using the following logical formulas:

P(n): n>1 ∧ [ for all i from 2 to sqrt(n)-1 (n%i ≠ 0 )]

P'(n): n>1 ∧ ∃ j from 2 to sqrt(n)  s.t ( n%j = 0)

The two P and P' formulas provide the mathematical foundations to code a program that will generate the first 10 prime numbers. and prints them out to the screen. 

Here is my attempt at writing this code however my solution it is highly inefficient and does not produce the right output. Could you please guide me? 

my code:

prime_count = 0
i = 2
while (prime_count < 10): 
    flag = all(i%n != 0 for n in range(2, int(i**0.5)+1))
    if (flag):
        print(i)
       prime_count = prime_count + 1
        i = i +1
    else:
       i = i +1[/INST]