Ejemplo n.º 1
0
 public void ShouldReturnExpectedValues(
     int maxValue,
     int[] expected)
 {
     GeneratePrimes.Generate(maxValue)
     .Should().Equal(expected);
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var result = GeneratePrimes.GeneratePrimeNumbers(10000);

            foreach (var prime in result)
            {
                Console.WriteLine(prime);
            }

            Console.ReadLine();
        }
Ejemplo n.º 3
0
    void Start()
    {
        GameObject obj = GameObject.Find("/Empty");

        //generator = obj.GetComponent<GenerateList>();
        generator = obj.GetComponent <GeneratePrimes>();

        xyz    = new Vector3[3];
        xyz[0] = Vector3.right;
        xyz[1] = Vector3.up;
        xyz[2] = -Vector3.forward;         //Unity's positive z-axis is backwards! (reference: Right-Hand Rule)

        size    = new ulong[3];
        size[0] = 1;
        size[1] = 1;
        size[2] = 1;
    }
Ejemplo n.º 4
0
        public void TestPrimes()
        {
            int[] nullArray = GeneratePrimes.GeneratePrimeNumbers(0);
            Assert.AreEqual(nullArray.Length, 0);

            int[] minArray = GeneratePrimes.GeneratePrimeNumbers(2);
            Assert.AreEqual(minArray.Length, 1);
            Assert.AreEqual(minArray[0], 2);

            int[] treeArray = GeneratePrimes.GeneratePrimeNumbers(3);
            Assert.AreEqual(treeArray.Length, 2);
            Assert.AreEqual(treeArray[0], 2);
            Assert.AreEqual(treeArray[1], 3);

            int[] centArray = GeneratePrimes.GeneratePrimeNumbers(100);
            Assert.AreEqual(centArray.Length, 25);
            Assert.AreEqual(centArray[24], 97);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Console.WriteLine();

            Console.WriteLine(MultiplesOf3and5.SumOfMultiplesOf3and5(1000));

            Console.WriteLine();

            EvenFibonacciNumbers.RunFib(89);

            Console.WriteLine();

            Console.WriteLine(EvenFibonacciNumbers.SumOfEvenNumbers(4000000));

            Console.WriteLine();

            var primes = GeneratePrimes.GenerateAllPrimesForMaxValue(13195);

            foreach (var prime in primes)
            {
                Console.Write($"{prime} ");
            }

            Console.WriteLine();

            Console.WriteLine(LargestPrimeFactor.FindLargesPrimeFactor(600851475143));

            Console.WriteLine();

            var largestPalindrome = new LargestPalindromeV2(2);

            var product = largestPalindrome.FindLargestPalendromeProduct();

            Console.WriteLine(product);

            Console.WriteLine();
        }
Ejemplo n.º 6
0
    void Start()
    {
        GameObject obj = GameObject.Find("/Empty");

        generator = obj.GetComponent <GeneratePrimes>();
    }