Lazy (prime?)

25 views
Skip to first unread message

Spencer Weight

unread,
Dec 7, 2013, 4:14:06 PM12/7/13
to byu-cs-330...@googlegroups.com
I assume we are programming the prime? function in Lazy, so I need a bit of clarification

Is there a function that would be useful for us to know about to help us program for the prime? function,
or should we use the formula learned in 312?

I only ask because I'm not sure how to test if a number is prime other than that.

Andrew Kent

unread,
Dec 7, 2013, 4:19:50 PM12/7/13
to Spencer Weight, BYU CS 330 Fall 2013
You'll want to utilize the fundamental theorem of arithmetic if I remember correctly...

In 312 don't you learn an algorithm that gives you a probabilistic guarantee that the number is prime (and thus *does not* guarantee the number is prime)?

-Andrew


--
You received this message because you are subscribed to the Google Groups "byu-cs-330-fall-2013" group.
To unsubscribe from this group and stop receiving emails from it, send an email to byu-cs-330-fall-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
-Andrew

Andrew Kent

unread,
Dec 7, 2013, 4:21:19 PM12/7/13
to Spencer Weight, BYU CS 330 Fall 2013
Well regardless of what was in 312, if you confirm a number has no prime divisors, it is guaranteed to be prime =)
--
-Andrew

Spencer Weight

unread,
Dec 7, 2013, 4:37:56 PM12/7/13
to byu-cs-330...@googlegroups.com, Spencer Weight
Thanks, that helps :)

Jay McCarthy

unread,
Dec 7, 2013, 7:55:46 PM12/7/13
to Andrew Kent, Spencer Weight, BYU CS 330 Fall 2013
Andrew is correct. The Fermat Primality Test is BS.
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Jay McCarthy

unread,
Dec 10, 2013, 5:55:19 PM12/10/13
to Willard Hagen, BYU 2013
What is "this"?

Primes/fast works very very fast

Sent from my iPhone

On Dec 10, 2013, at 3:10 PM, Willard Hagen <willar...@gmail.com> wrote:

How high of a number does this give in a reasonable amount of time?
-Willard

Jay McCarthy

unread,
Dec 10, 2013, 6:57:48 PM12/10/13
to Willard Hagen, BYU 2013
It's pretty slow

Sent from my iPhone

On Dec 10, 2013, at 4:52 PM, Willard Hagen <willar...@gmail.com> wrote:

I mean the regular prime function
--
-Willard
Reply all
Reply to author
Forward
0 new messages