Go back
prime number generators/sieves

prime number generators/sieves

General

g
Wayward Soul

Your Blackened Sky

Joined
12 Mar 02
Moves
15128
Clock
22 Mar 07
Vote Up
Vote Down

i'm doing a project for my honours course where i essentially have to code something-anything-in maple. so i thought it would be nice to look at prime sieves and compare them to maple's in built isprime() function (which uses fermats little theorem). so far i've got a fully functioning sieve of Eratosthenes', and am working on a sieve of Atkin. does anyone know of any other fancy ways of either creating lists of or generating prime numbers?

thanks 🙂

aw
Baby Gauss

Ceres

Joined
14 Oct 06
Moves
18375
Clock
22 Mar 07
1 edit
Vote Up
Vote Down

Originally posted by genius
i'm doing a project for my honours course where i essentially have to code something-anything-in maple. so i thought it would be nice to look at prime sieves and compare them to maple's in built isprime() function (which uses fermats little theorem). so far i've got a fully functioning sieve of Eratosthenes', and am working on a sieve of Atkin. does anyone kn ...[text shortened]... f any other fancy ways of either creating lists of or generating prime numbers?

thanks 🙂
if you like C language or c++ I think it's quite easy to make a routine that checks if a given number is a prime or not. then all you have to is to store the ones that your routine says are primes.

m
Ajarn

Wat?

Joined
16 Aug 05
Moves
76863
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by genius
i'm doing a project for my honours course where i essentially have to code something-anything-in maple. so i thought it would be nice to look at prime sieves and compare them to maple's in built isprime() function (which uses fermats little theorem). so far i've got a fully functioning sieve of Eratosthenes', and am working on a sieve of Atkin. does anyone kn ...[text shortened]... f any other fancy ways of either creating lists of or generating prime numbers?

thanks 🙂
A good reference is The Lore of Prime Numbers by G. P. Loweke (1982). The bibliography there leads to more specific references in special areas that you are mentioning.

X
Cancerous Bus Crash

p^2.sin(phi)

Joined
06 Sep 04
Moves
25076
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by adam warlock
if you like C language or c++ I think it's quise to make a routine that checks if a given number is a prime or not. then all you have to is to store the ones that your routine says are primes.
Not quite what genius is looking for. The C routine is likely using a brute force method (there is no easy way to check if a given number is prime for a large given number leaving aside deterministic tests for the moment).

Other possibly interesting prime checks could be:

Wilson's Theorem (If (x - 1)! = -1(mod x) then x is prime or 4, if it is not then x is composite)
Proth's Theorem http://mathworld.wolfram.com/ProthsTheorem.html (Finds primes of a certain form)

Or if you want a challenge, the Pollard rho Factorization Method. A fast factorization method that involves iteration until some form of stable behaviour is reached.

m
Ajarn

Wat?

Joined
16 Aug 05
Moves
76863
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by XanthosNZ
Not quite what genius is looking for. The C routine is likely using a brute force method (there is no easy way to check if a given number is prime for a large given number leaving aside deterministic tests for the moment).

Other possibly interesting prime checks could be:

Wilson's Theorem (If (x - 1)! = -1(mod x) then x is prime or 4, if it is not th ...[text shortened]... t factorization method that involves iteration until some form of stable behaviour is reached.
I was just about to write that as I saw your post arrive...........damned!

aw
Baby Gauss

Ceres

Joined
14 Oct 06
Moves
18375
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by XanthosNZ
Not quite what genius is looking for. The C routine is likely using a brute force method (there is no easy way to check if a given number is prime for a large given number leaving aside deterministic tests for the moment).

Other possibly interesting prime checks could be:

Wilson's Theorem (If (x - 1)! = -1(mod x) then x is prime or 4, if it is not th ...[text shortened]... t factorization method that involves iteration until some form of stable behaviour is reached.
the C routine is brute force indeed, but i thought it could be fun for him to do it and the routine is quite easy to do. and afterwards he could refinite a little bit. but the best way is to use sharper methods.

w
If Theres Hell Below

We're All Gonna Go!

Joined
10 Sep 05
Moves
10228
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by adam warlock
the C routine is brute force indeed, but i thought it could be fun for him to do it and the routine is quite easy to do. and afterwards he could refinite a little bit. but the best way is to use sharper methods.
the "sharper methods" is what he's asking about...

aw
Baby Gauss

Ceres

Joined
14 Oct 06
Moves
18375
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by wormwood
the "sharper methods" is what he's asking about...
already got that point.but i stil think that a C routine could be a fun job. and that's all. sorry if my superfluos post upset you. 😛

c
Copyright ©2001-2006

Eastbourne

Joined
20 Sep 04
Moves
16434
Clock
22 Mar 07
Vote Up
Vote Down

sieve

http://ahsdirect.co.uk/category/98/

L

Joined
18 Jan 06
Moves
3054
Clock
22 Mar 07
Vote Up
Vote Down

This is a nerd thread.

a

THORNINYOURSIDE

Joined
04 Sep 04
Moves
245624
Clock
22 Mar 07
1 edit
Vote Up
Vote Down

Originally posted by LanndonKane
This is a nerd thread.
Don't tell Seitse.

X
Cancerous Bus Crash

p^2.sin(phi)

Joined
06 Sep 04
Moves
25076
Clock
22 Mar 07
Vote Up
Vote Down

Originally posted by adam warlock
already got that point.but i stil think that a C routine could be a fun job. and that's all. sorry if my superfluos post upset you. 😛
The sieve of Eratosthenes' is a brute force method of finding primes, except it gives you all the primes up to a number.

aw
Baby Gauss

Ceres

Joined
14 Oct 06
Moves
18375
Clock
23 Mar 07
Vote Up
Vote Down

Originally posted by XanthosNZ
The sieve of Eratosthenes' is a brute force method of finding primes, except it gives you all the primes up to a number.
yeah. i know that. the c routine that i was thinking about does exactly that too. at least in the way i'm thinking that he should implement it. that was one of the first things i learned in college so i don't think it'll be to hard for him to do.and with it he might get a feel of what the sharper methods are about.
but i don't understand why you replied that to me... 😕

g
Wayward Soul

Your Blackened Sky

Joined
12 Mar 02
Moves
15128
Clock
23 Mar 07
Vote Up
Vote Down

Originally posted by adam warlock
yeah. i know that. the c routine that i was thinking about does exactly that too. at least in the way i'm thinking that he should implement it. that was one of the first things i learned in college so i don't think it'll be to hard for him to do.and with it he might get a feel of what the sharper methods are about.
but i don't understand why you replied that to me... 😕
well, the harder it is to code the better, really...the more complicated my project the better my chances are of getting a good grade... 😛

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.