Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class problem
- {
- static void Main()
- {
- long a = 600851475143;
- int b = Convert.ToInt32(Math.Sqrt(a));
- int c = 0;
- for (int i = b; i >= 2; i--)
- {
- if (a % i == 0)
- c = ChkPrime(i);
- if (c > 0)
- break;
- }
- Console.WriteLine(c);
- }
- static int ChkPrime(int c)
- {
- for (int i = 2; i < Math.Sqrt(c); i++)
- if (c % i == 0)
- {
- c = -1;
- break;
- }
- return c;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment