¡@

Home 

c# Programming Glossary: isprime

Most elegant way to generate prime numbers

http://stackoverflow.com/questions/1042902/most-elegant-way-to-generate-prime-numbers

int nextPrime int primes primes.Count 1 2 while true bool isPrime true foreach int n in primes if nextPrime n 0 isPrime false.. isPrime true foreach int n in primes if nextPrime n 0 isPrime false break if isPrime break else nextPrime 2 primes.Add.. in primes if nextPrime n 0 isPrime false break if isPrime break else nextPrime 2 primes.Add nextPrime return primes..

Program to find prime numbers

http://stackoverflow.com/questions/1510124/program-to-find-prime-numbers

class Program void prime_num long num bool isPrime true for int i 0 i num i for int j 2 j num j if i j i j.. int i 0 i num i for int j 2 j num j if i j i j 0 isPrime false break if isPrime Console.WriteLine Prime i isPrime.. j 2 j num j if i j i j 0 isPrime false break if isPrime Console.WriteLine Prime i isPrime true static void Main..

C#: How to make Sieve of Atkin incremental

http://stackoverflow.com/questions/1569393/c-how-to-make-sieve-of-atkin-incremental

limit primes new List ulong private void FindPrimes var isPrime new bool limit 1 var sqrt Math.Sqrt limit for ulong x 1 x sqrt.. y 1 y sqrt y var n 4 x x y y if n limit n 12 1 n 12 5 isPrime n ^ true n 3 x x y y if n limit n 12 7 isPrime n ^ true .. n 12 5 isPrime n ^ true n 3 x x y y if n limit n 12 7 isPrime n ^ true n 3 x x y y if x y n limit n 12 11 isPrime n ^ true..

Prime Number Formula

http://stackoverflow.com/questions/3285562/prime-number-formula

on checking whether a number is prime could be boolean isPrime int number if number 1 return false if number 2 return true..

What is the purpose/advantage of using yield return iterators in C#?

http://stackoverflow.com/questions/1088442/what-is-the-purpose-advantage-of-using-yield-return-iterators-in-c

IEnumerable int GetPrimeNumbers for int num 2 num if IsPrime num yield return num static void Main foreach var i in GetPrimeNumbers..

when & why to use delegates? [duplicate]

http://stackoverflow.com/questions/2019402/when-why-to-use-delegates

Prime Number Formula

http://stackoverflow.com/questions/3285562/prime-number-formula

it will work no matter how big the number is static bool IsPrime int number if number 2 number 3 number 5 number 7 number 9 return..

How can I test for primality?

http://stackoverflow.com/questions/627463/how-can-i-test-for-primality

Method for testing the primality of a number e.g. return IsPrime 29 History 1. Initial version most basic form of testing m smaller.. number is prime false otherwise returns public static bool IsPrime int test 0 and 1 are not prime numbers if test 0 test 1 return.. static int MaxPrime get private set public static bool IsPrime int value if value MaxPrime return Array.BinarySearch primes..