예제 #1
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                prlong_msg_and_exit();
            }

            // 素因数分解したい値の指定
            BigInteger n = new BigInteger(0);

            try
            {
                n = BigInteger.Parse(args[0]);
            }
            catch (Exception e)
            {
                Console.WriteLine("new BigInteger(" + args[0] + ") ... error.");
                Console.WriteLine(e.ToString() + "\n");
                Environment.Exit(-1);
            }

            PrimeFactorization pf = new PrimeFactorization();

            pf.Main(n);
        }
예제 #2
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                prlong_msg_and_exit();
            }

            // 素因数分解したい値の指定
            long n;

            if (long.TryParse(args[0], out n) == false)
            {
                Console.WriteLine(args[0] + " in not numeric.");
                return;
            }

            n = long.Parse(args[0]);

            PrimeFactorization pf = new PrimeFactorization();

            pf.Main(n);
        }