fork download
  1. @echo off
  2. REM 適当なbatファイルに保存して実行
  3. setlocal EnableDelayedExpansion
  4. set LF=^
  5.  
  6.  
  7. set primes=2
  8. set /a num=1,limit=3,pow=9
  9. :loop
  10. set /a num+=2
  11. if %num% gtr 10000 goto show
  12. if %num% equ %pow% (
  13. set /a limit+=2
  14. set /a pow=!limit!*!limit!
  15. goto loop
  16. )
  17. :loop2
  18. for /f "skip=1" %%p in ("!primes!") do (
  19. if %%p geq %limit% goto setprime
  20. set /a mod=%num%%%%%p
  21. if !mod! equ 0 goto loop
  22. )
  23. :setprime
  24. set primes=!primes!!LF!%num%
  25. goto loop
  26. :show
  27. for /f %%p in ("!primes!") do echo %%p
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty