diff --git a/X10D/Int64Extensions.cs b/X10D/Int64Extensions.cs
index 908df84..8161763 100644
--- a/X10D/Int64Extensions.cs
+++ b/X10D/Int64Extensions.cs
@@ -204,7 +204,7 @@
return false;
}
- long boundary = (long)Math.Floor(Math.Sqrt(number));
+ long boundary = (long) Math.Floor(Math.Sqrt(number));
for (int i = 3; i <= boundary; i += 2)
{
if (number % i == 0)
@@ -216,6 +216,41 @@
return true;
}
+ ///
+ /// Determines if the is a prime number.
+ ///
+ /// The number.
+ /// Returns if is prime,
+ /// otherwise.
+ public static bool IsPrime(this ulong number)
+ {
+ if (number <= 1)
+ {
+ return false;
+ }
+
+ if (number == 2)
+ {
+ return true;
+ }
+
+ if (number % 2 == 0)
+ {
+ return false;
+ }
+
+ ulong boundary = (ulong) Math.Floor(Math.Sqrt(number));
+ for (uint i = 3; i <= boundary; i += 2)
+ {
+ if (number % i == 0)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
///
/// Gets an boolean value that represents this integer.
///