Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Diagnostics;
- namespace PE29
- {
- class Program
- {
- static void Main(string[] args)
- {
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List<double> powers = new List<double>();
- for (double i = 2; i <= 100; i++)
- {
- for (double k = 2; k <= 100; k++)
- {
- powers.Add(Math.Pow(i, k));
- }
- }
- double[] discretePowers = powers.Distinct().ToArray();
- sw.Stop();
- Console.WriteLine("The total number of discrete powers is {0}. Runtime is {1}ms.",
- discretePowers.Length, sw.ElapsedMilliseconds);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment