Beispiel #1
0
 // chvilku to trva vypocet
 public long Solve()
 {
     var sum = 0L;
     var primes = new Prime(Limit);
     for (var number = 2; number <= Limit; number++)
     {
         sum += primes.Totient(number);
     }
     return sum;
 }
Beispiel #2
0
        public long Solve()
        {
            var prime = new Prime((long)1000000);

            for (var number = 2; number <= 1000000; number++)
            {
                var totient = prime.Totient(number);

                if (number % 10000 == 0)
                {
                    Console.WriteLine("{0} - {1} - {2}", number, totient, (decimal)totient / (number - 1));
                }

                if ((decimal)totient / (number - 1) < Limit)
                    return number;
            }

            return 0;
        }