Thursday, 2 July 2020

List of primes in CMD

This program aims to make a program that will give a list of prime numbers (slowly...) from 2 to infinity.
  • Start notepad.exe on your system or Notepad++
  • Type the following: 
@echo off
echo 2 
set /a n=1
:x 
set /a n=%n%+2
set /a s=1
:a
set /a s=%s%+1
if %s% equ %n% goto c
set /a a=%n% %% %s%
if %a% equ 0 goto b
goto a
:b   
goto x
:c
echo %n% 
goto x

  • Save this as primelist.cmd at desktop
  • Double-click on the file to start the program

No comments:

Post a Comment

Algorithmic Pixel Art: The Beauty of Aliasing

Discussed  here More images in  Google drive Some outputs: Forward to anyone who says aliasing is ugly.