fork download
  1. var max = 10001, n=1, p=1; var f,j,s
  2. while (n <= max)
  3. { f=0; j=2; s = parseInt(Math.pow(p, 0.5))
  4. while (f < 1)
  5. { if (j >= s) f=2
  6. if ( p % j == 0 ) f=1
  7. j++
  8. }
  9. if (f != 1) n++ // { print(n +" "+ p) }
  10. p++
  11. }
  12. print((n-1) +" "+ (p-1))
Success #stdin #stdout 0.06s 17548KB
stdin
Standard input is empty
stdout
10001 104743