@echo off
REM 適当なbatファイルに保存して実行
setlocal EnableDelayedExpansion
set LF=^
set primes=2
set /a num=1,limit=3,pow=9
:loop
set /a num+=2
if %num% gtr 10000 goto show
if %num% equ %pow% (
set /a limit+=2
set /a pow=!limit!*!limit!
goto loop
)
:loop2
for /f "skip=1" %%p in ("!primes!") do (
if %%p geq %limit% goto setprime
set /a mod=%num%%%%%p
if !mod! equ 0 goto loop
)
:setprime
set primes=!primes!!LF!%num%
goto loop
:show
for /f %%p in ("!primes!") do echo %%p
QGVjaG8gb2ZmClJFTSDpganlvZPjgapiYXTjg5XjgqHjgqTjg6vjgavkv53lrZjjgZfjgablrp/ooYwKc2V0bG9jYWwgRW5hYmxlRGVsYXllZEV4cGFuc2lvbgpzZXQgTEY9XgoKCnNldCBwcmltZXM9MgpzZXQgL2EgbnVtPTEsbGltaXQ9Myxwb3c9OQo6bG9vcAogc2V0IC9hIG51bSs9MgogaWYgJW51bSUgZ3RyIDEwMDAwIGdvdG8gc2hvdwogaWYgJW51bSUgZXF1ICVwb3clICgKICBzZXQgL2EgbGltaXQrPTIKICBzZXQgL2EgcG93PSFsaW1pdCEqIWxpbWl0IQogIGdvdG8gbG9vcAogKQo6bG9vcDIKIGZvciAvZiAic2tpcD0xIiAlJXAgaW4gKCIhcHJpbWVzISIpIGRvICgKICBpZiAlJXAgZ2VxICVsaW1pdCUgZ290byBzZXRwcmltZQogIHNldCAvYSBtb2Q9JW51bSUlJSUlcAogIGlmICFtb2QhIGVxdSAwIGdvdG8gbG9vcAogKQo6c2V0cHJpbWUKIHNldCBwcmltZXM9IXByaW1lcyEhTEYhJW51bSUKIGdvdG8gbG9vcAo6c2hvdwogZm9yIC9mICUlcCBpbiAoIiFwcmltZXMhIikgZG8gZWNobyAlJXA=