SCRIPTS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>

7-DAY TOP DOWNLOAD

#
Program
Synergy 0.9.2
3,602
aircrack 1.0RC1
1,699
Scary Maze
1,251
QuickPlay 3.8.4
1,005
Virtual Floppy Drive
2.1

975
Netcat 0.7.1
817
JDownload 0.9
813
Flash Flip Book
2.0.1

678
DjVu 0.8.0.9
668
Proxy List
631
Home / Scripts / Scientific/Engineering / Mathematics

ISPR




Downloads: 133  Add to download basket  Tell us about an update
User Rating:
Rated by:
Fair (2.1/5)
22 user(s)
Developer:

License / Price:
Platforms:

Databases:

Language:

Last Updated:

Category:
Michael Kleder | More scripts
Freeware 
Windows / Linux / Mac OS / BSD / Solaris
N/A
Matlab
August 30th, 2007, 15:00 GMT
C: \ Scientific/Engineering \ Mathematics

 Read user reviews (0)  Add a review  Refer to a friend  Subscribe

 

ISPR description

 

ISPR - Use a Java to rapidly determine whether an arbitrarily large positive integer is a prime

ISPR - Rapidly determine whether an arbitrarily large positive integer is a probable prime.

USAGE: q = ispr(n)
q = ispn(n,1)

n = positive integer, either as a numeric or string datatype

q = 1 if n is prime, 0 if n is composite

1 = any second input will cause the function to output a message describing the result in plain language, including (if n is probably prime) a statement about the certainty with which n is claimed to be prime.

Notes: Probable primes are also known as "industrial strength" primes because of the exceedlingly high probability -- but not certainty -- of primality. This function utilizes the Java class "BigInteger" with its method
"isProbablePrime."

For small integers, you can use numeric inputs; however, for abitrarily large integers, you must input the number as a string in order to avoid an overflow. Note the overflow error in the second to last example below.

Examples:

>>ispr(314159,1)
I believe that 314159 is prime, but there is a 1 in 590295810358705650000 chance that I am mistaken.

>>ispr('338327950288419716939',1)
I believe that 338327950288419716939 is prime, but there is a 1 in  64613997892457940000000000000000000 chance that I am mistaken.

>>ispr(338327950288419716939,1)
338327950288419680000 is definitely not prime.

>> for i=1:1000;if ispr(i);fprintf('%i ',i);end;end;fprintf('')

Michael Kleder, September 2004





TAGS:

matlab ISPR | ISPR mathematics | matlab mathematics | matlab | ISPR | mathematics

Related downloads IT News Popular downloads New additions   Latest reviews  
naninterp
naninterp - One dimensional Interpolation over NaNs.
INSERTROWS
INSERTROWS - Insert rows into a matrix at specific locations
fshift
fshift shifts the elements of an array by a (possibly non-integer) given number of elements.
unique_no_sort
unique_no_sort - Like unique.m but without sorting
matlab mep
mep creates epochs (0|1) in a logical array according to a list of indices (begin:end).


HTML code for linking to this page:


Go to top



SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM