The Daily Click ::. Forums ::. Digital Works ::. Fast Prime Number finder (C++)
 

Post Reply  Post Oekaki 
 

Posted By Message

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49609

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
16th February, 2011 at 20:39:39 -

Ok, this is different

I wrote a prime finder in batch:

Copy and paste it into notepad and rename the extension to .bat


@echo off
set test=2
echo. > primes.txt

:loop
if %test%==2 goto :prime
if %test%==3 goto :prime
if %test%==5 goto :prime
if %test%==7 goto :prime

set /a max=test/2
set i=1

:test
set /a i=i+1
set /a check=test/i
set /a check2=check*i
if %test%==%check2% goto :notprime
if not %i%==%max% goto :test

:prime
echo %test% >> primes.txt
set /a test=test+1
goto :loop

:notprime
set /a test=test+1
goto :loop

Edited by UrbanMonk

 
n/a

~Matt Esch~

Stone Goose

Registered
  30/12/2006
Points
  870

VIP Member
16th February, 2011 at 21:14:45 -

www.mth.pdx.edu/~caughman/Gabe.pdf

An interesting read.

 
http://create-games.com/project.asp?id=1875 Image


Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2722
19th February, 2011 at 13:54:31 -

How about an arm version of this algorithm? O wait that speeds things up on the gba, not windows.

 
Image jenswa.neocities.org
   

Post Reply



 



Advertisement

Worth A Click