By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,677 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,677 IT Pros & Developers. It's quick & easy.

Prime Numbers

P: n/a
Hello!

I have been doing some research to see if C++ has some sort of
function to work with prime numbers.

For example, I would like to input integers and have the program check
to see if the integers are prime numbers.

I have been unsuccessful in finding anything. I am sure I can probably
figure out a long way to do it, but I was curious to see if C++ had
something available.

Thanks!
Chris
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Chris" <de*****@verizon.net> wrote...
I have been doing some research to see if C++ has some sort of
function to work with prime numbers.

For example, I would like to input integers and have the program check
to see if the integers are prime numbers.

I have been unsuccessful in finding anything. I am sure I can probably
figure out a long way to do it, but I was curious to see if C++ had
something available.


The Standard library does NOT have such a function. If it did,
all those seekers of the largest number would have nothing to
do, would they?

Try www.google.com.

Victor
Jul 19 '05 #2

P: n/a
In article <2e*************************@posting.google.com> ,
de*****@verizon.net says...
Hello!

I have been doing some research to see if C++ has some sort of
function to work with prime numbers.
None that's particular to prime numbers, and not really much that's any
more than a building-block toward working with large numbers in general.
For example, I would like to input integers and have the program check
to see if the integers are prime numbers.
Depending on how big of numbers you want to deal with, that's anywhere
from trivial (e.g. < 20 digits) to a massive project (e.g. the General
Number Field Sieve is one of the most complex algorithms ever devised by
man).
I have been unsuccessful in finding anything. I am sure I can probably
figure out a long way to do it, but I was curious to see if C++ had
something available.


The MIRACL library has quite a nice factoring program as a free demo of
its capabilities. You can get the library (with the demo) from:
ftp://ftp.computing.dcu.ie/pub/crypto/miracl.zip

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 19 '05 #3

P: n/a

"Jerry Coffin" <jc*****@taeus.com> wrote in message
news:MP************************@news.clspco.adelph ia.net...
In article <2e*************************@posting.google.com> ,
de*****@verizon.net says...
Hello!

I have been doing some research to see if C++ has some sort of
function to work with prime numbers.


None that's particular to prime numbers, and not really much that's any
more than a building-block toward working with large numbers in general.
For example, I would like to input integers and have the program check
to see if the integers are prime numbers.


Depending on how big of numbers you want to deal with, that's anywhere
from trivial (e.g. < 20 digits) to a massive project (e.g. the General
Number Field Sieve is one of the most complex algorithms ever devised by
man).
I have been unsuccessful in finding anything. I am sure I can probably
figure out a long way to do it, but I was curious to see if C++ had
something available.


The MIRACL library has quite a nice factoring program as a free demo of
its capabilities. You can get the library (with the demo) from:
ftp://ftp.computing.dcu.ie/pub/crypto/miracl.zip

--
Later,
Jerry.


Not to forget the nice "Miller Rabin probabilistic primality" test, which
IMHO is just a piece of art.

Cheers
Chris
Jul 19 '05 #4

P: n/a

Not to forget the nice "Miller Rabin probabilistic primality" test, which
IMHO is just a piece of art.

Yes.
Rabin's work was based on randomized algorithms.
It shows how sometimes randomized algorithms solve problems much more easily
over their deterministic counterparts.


Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.