fork download
  1. <?php
  2. $input = trim(fgets(STDIN));
  3. for ($i = 2; $i <= $input; $i++) {
  4. $isPrime = 0;
  5.  
  6. for ($j = 1; $j <= $i; $j++) {
  7. $res = $i % $j;
  8.  
  9. $isPrime++;
  10. if ($isPrime == 2) {
  11. echo $i;
  12.  
  13. }
  14. }
  15. }
Success #stdin #stdout 0.02s 25500KB
stdin
10
stdout
2345678910