1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<form action="#" method="get">
  <input name="start" type="text" value="<?php echo isset($_GET) ? $_GET['start'] : '' ?>" />
  <input name="end" type="text" value="<?php echo isset($_GET) ? $_GET['end'] : '' ?>" />
  <input name="submit" type="submit" value="Go!" />
</form>
 
<?php
  for ($i = $_GET['start']; $i <= $_GET['end']; $i++)
  {
    if ($i % 2 != 1) 
      continue;
    
    $d = 3;
    $x = sqrt($i);
    
    while ($i % $d != 0 && $d < $x) 
      $d += 2;
    
    if ((($i % $d == 0 && $i != $d) * 1) == 0) 
      echo $i.' ';
  }