- @echo off&setlocal enabledelayedexpansion
- for /l %%a in (2,1,2147483647) do (
- set Xing=
- set Han=%%a
- call:han
- if "!Xing!"=="*%%a" (echo %%a为质数) else echo %%a=!Xing:~1!
- )
- pause&exit
- :han
- for /l %%a in (2,1,%Han%) do call:ye %%a
- goto:eof
- :ye
- set/a Ye=%1,Gu=Han%%Ye
- if defined #%Ye% goto:xing
- if %Gu% neq 0 (goto:eof) else for /l %%a in (2,1,%Ye%) do call:gu %%a
- :gu
- set/a Gu=Han%%%1
- :xing
- if %Gu% neq 0 (goto:eof) else (
- set/a Han=Han/Ye
- set Xing=!Xing!*%Ye%
- if not defined #%Ye% set #%Ye%==
- goto:han
- )
复制代码
[ 本帖最后由 hanyeguxing 于 2010-12-21 18:57 编辑 ] |