Ejemplo n.º 1
0
        public static bool IsPrime(long Number)
        {
            IList <long> basicPrimeNumbers = new List <long>()
            {
                2, 3, 5, 7
            };

            if (basicPrimeNumbers.Contains(Number))
            {
                return(true);
            }

            return(ExtendedEnumerableRange.Int64(2, (long)Math.Sqrt(Number))
                   .All(n => Number % n != 0));
        }
Ejemplo n.º 2
0
 public static IEnumerable <DateTime> DateTime(DateTime from, DateTime to)
 {
     return(ExtendedEnumerableRange.DateTime(from, to, 1.0));
 }
Ejemplo n.º 3
0
 public static IEnumerable <decimal> Decimal(decimal from, decimal to)
 {
     return(ExtendedEnumerableRange.Decimal(from, to, 1.0m));
 }
Ejemplo n.º 4
0
 public static IEnumerable <double> Double(double from, double to)
 {
     return(ExtendedEnumerableRange.Double(from, to, 1.0));
 }
Ejemplo n.º 5
0
 public static IEnumerable <float> Single(float from, float to)
 {
     return(ExtendedEnumerableRange.Single(from, to, 1.0f));
 }
Ejemplo n.º 6
0
 public static IEnumerable <ulong> UInt64(ulong from, ulong to)
 {
     return(ExtendedEnumerableRange.UInt64(from, to, 1UL));
 }
Ejemplo n.º 7
0
 public static IEnumerable <char> Char(char from, char to, int step)
 {
     return(ExtendedEnumerableRange.Int32(from, to, step).Select(i => (char)i));
 }
Ejemplo n.º 8
0
 public static long Sum(long N)
 {
     return(ExtendedEnumerableRange.Int64(1, N).Sum());
 }
Ejemplo n.º 9
0
 public static IEnumerable <int> Int32(int from, int to)
 {
     return(ExtendedEnumerableRange.Int32(from, to, 1));
 }
Ejemplo n.º 10
0
 public static IEnumerable <ushort> UInt16(ushort from, ushort to)
 {
     return(ExtendedEnumerableRange.UInt16(from, to, 1));
 }
Ejemplo n.º 11
0
 public static IEnumerable <short> Int16(short from, short to)
 {
     return(ExtendedEnumerableRange.Int16(from, to, 1));
 }
Ejemplo n.º 12
0
 public static IEnumerable <char> Char(char from, char to)
 {
     return(ExtendedEnumerableRange.Char(from, to, 1));
 }
Ejemplo n.º 13
0
 public static IEnumerable <byte> Byte(byte from, byte to)
 {
     return(ExtendedEnumerableRange.Byte(from, to, 1));
 }
Ejemplo n.º 14
0
 public static IEnumerable <sbyte> SByte(sbyte from, sbyte to)
 {
     return(ExtendedEnumerableRange.SByte(from, to, 1));
 }
Ejemplo n.º 15
0
 public static IEnumerable <ushort> UInt16(ushort from, ushort to, int step)
 {
     return(ExtendedEnumerableRange.Int32(from, to, step).Select(i => (ushort)i));
 }
Ejemplo n.º 16
0
 public static IEnumerable <uint> UInt32(uint from, uint to)
 {
     return(ExtendedEnumerableRange.UInt32(from, to, 1U));
 }
Ejemplo n.º 17
0
 public static IEnumerable <long> Int64(long from, long to)
 {
     return(ExtendedEnumerableRange.Int64(from, to, 1L));
 }
Ejemplo n.º 18
0
 public static long SumSquared(long N)
 {
     return(ExtendedEnumerableRange.Int64(1, N).Sum(n => n * n));
 }
Ejemplo n.º 19
0
 public static IEnumerable <byte> Byte(byte from, byte to, int step)
 {
     return(ExtendedEnumerableRange.Int32(from, to, step).Select(i => (byte)i));
 }