_(n,1,n,0) is true if n is prime.

I set out to create an O(n^n) algorithm. It essentially computes the
product of every possible set of n integers in the range (1..n-1). If
any of those products equal n, the number is composite. You will
notice that the program does not use the * operator to perform a
multiplication. It does use * as a logical AND, but to do the products
it uses a recursive call with t=1, which is a flag to tell _ to do
multiplication instead of determining if n is prime. It does the
multiplication by recursively adding up m*n ones. As a result, it
takes billions of recursive calls to determine that 6 is not prime.
Don

On Aug 17, 10:33 am, Sanjay Rajpal <srn...@gmail.com> wrote:
> @Don : can you plz explain it ?
>
> Sanjay Kumar
> B.Tech Final Year
> Department of Computer Engineering
> National Institute of Technology Kurukshetra
> Kurukshetra - 136119
> Haryana, India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to