Results 1 to 40 of 74

Thread: Prime Numbers

Threaded View

  1. #13

    Thread Starter
    Hyperactive Member storm5510's Avatar
    Join Date
    Jul 2009
    Location
    Indiana, U.S.A.
    Posts
    329

    Re: Prime Numbers

    Quote Originally Posted by TriLogic
    Sorry if this sounds too confusing to be of any use.
    It is. I need to study it more.


    Quote Originally Posted by Pradeep1210
    This is just a basic one and it takes less that half a second to list all primes upto 100,000
    And if one wanted to run this indefinitely? What I mean is, it would take a bit more.

    I appreciate everyone replies. What I am using is below:


    Code:
    Function IsPrimeA(ByVal N As ULong) As Short
    
            Dim C As ULong
    
            IsPrimeA = 0
    
            Half = N ^ 0.5
    
            For C = 3 To Half Step 2
                If N Mod C = 0 Then Exit Function
            Next
    
            IsPrimeA = 1
            Return IsPrimeA
    
    End Function
    Last edited by storm5510; Sep 5th, 2009 at 06:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width