jaigurudev's blog

By jaigurudev, 10 years ago, In English

Method 1 : for all n belonging to [l,u]{ if(n==2 || n==3) then n is prime and continue for all odd i belonging from 3 to sqrt(n) if i is a factor of n => n is not prime else n is prime }

Method 2: seive of eratosthenes Consider an array a = {2,3,4,...,u} do until array 'a' is non empty{ let x be the first element of 'a' in ascending order remove x and all its multiples from 'a' if x>=l => x is a prime in [l,u]
}

For Any other good methods .. please comment

  • Vote: I like it
  • -1
  • Vote: I do not like it