::********************************************* :: calculate the whole-numbered divisors of * :: a given number * :: Norman Krebs / Mo, 01.09.2003 22:16:10 * ::********************************************* @echo off if [%1]==[] ( echo divisors.cmd ^ exit /b ) set /a C=0 set /a L=%1 set /a I=2 echo !L! 1 :LOOP set /a M=%L% / !I! set /a S=m*!I! if !S! equ %L% ( if !I! neq %L% ( set /a C+=1 ) echo !M! !I! set /a P=!M! set /a Q=!I! ) set /a I+=1 if !M! gtr !I! goto :LOOP set /a C*=2 if !P! equ !Q! ( set /a C-=1 ) set /a C+=2 echo !C! divisors if !C! equ 2 (echo *** %L% is prime ***)