print_r(findPrimeNumbers(50));

//Prime numbers are evenly divided by themselves and by one
//Finds first N prime number
function findPrimeNumbers($n){
	$num=2;//first  prime number is 2
	$res=[];
	while  (0<$n){
		$cnt=0;
		for ($i=2; $i<=$num; $i++){
			if ($num%$i==0){
				$cnt++;
			}
		}
		if ($cnt==1){
			$res[]=$num;
			$n--;
		}
		$num++;
	}
	return $res;
}
by ვაჟა ტყემალაძე
2 years ago
PHP
Problem Solving
php
Note
Problem
0
Pro tip: use ```triple backticks around text``` to write in code fences