示例#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));
        }
 public static IEnumerable <DateTime> DateTime(DateTime from, DateTime to)
 {
     return(ExtendedEnumerableRange.DateTime(from, to, 1.0));
 }
 public static IEnumerable <decimal> Decimal(decimal from, decimal to)
 {
     return(ExtendedEnumerableRange.Decimal(from, to, 1.0m));
 }
 public static IEnumerable <double> Double(double from, double to)
 {
     return(ExtendedEnumerableRange.Double(from, to, 1.0));
 }
 public static IEnumerable <float> Single(float from, float to)
 {
     return(ExtendedEnumerableRange.Single(from, to, 1.0f));
 }
 public static IEnumerable <ulong> UInt64(ulong from, ulong to)
 {
     return(ExtendedEnumerableRange.UInt64(from, to, 1UL));
 }
 public static IEnumerable <char> Char(char from, char to, int step)
 {
     return(ExtendedEnumerableRange.Int32(from, to, step).Select(i => (char)i));
 }
示例#8
0
 public static long Sum(long N)
 {
     return(ExtendedEnumerableRange.Int64(1, N).Sum());
 }
 public static IEnumerable <int> Int32(int from, int to)
 {
     return(ExtendedEnumerableRange.Int32(from, to, 1));
 }
 public static IEnumerable <ushort> UInt16(ushort from, ushort to)
 {
     return(ExtendedEnumerableRange.UInt16(from, to, 1));
 }
 public static IEnumerable <short> Int16(short from, short to)
 {
     return(ExtendedEnumerableRange.Int16(from, to, 1));
 }
 public static IEnumerable <char> Char(char from, char to)
 {
     return(ExtendedEnumerableRange.Char(from, to, 1));
 }
 public static IEnumerable <byte> Byte(byte from, byte to)
 {
     return(ExtendedEnumerableRange.Byte(from, to, 1));
 }
 public static IEnumerable <sbyte> SByte(sbyte from, sbyte to)
 {
     return(ExtendedEnumerableRange.SByte(from, to, 1));
 }
 public static IEnumerable <ushort> UInt16(ushort from, ushort to, int step)
 {
     return(ExtendedEnumerableRange.Int32(from, to, step).Select(i => (ushort)i));
 }
 public static IEnumerable <uint> UInt32(uint from, uint to)
 {
     return(ExtendedEnumerableRange.UInt32(from, to, 1U));
 }
 public static IEnumerable <long> Int64(long from, long to)
 {
     return(ExtendedEnumerableRange.Int64(from, to, 1L));
 }
示例#18
0
 public static long SumSquared(long N)
 {
     return(ExtendedEnumerableRange.Int64(1, N).Sum(n => n * n));
 }
 public static IEnumerable <byte> Byte(byte from, byte to, int step)
 {
     return(ExtendedEnumerableRange.Int32(from, to, step).Select(i => (byte)i));
 }