Project Euler Problem #16

in code


/twitch

Anything to avoid using VS, right? For my pain, I learned that Bash, while being excellent for fast big arithmetic operations (compared to C#), doesn’t enjoy working with large multiples or exponents.

using System;
using System.Numerics;

class Program
{
    static void Main()
    {
        BigInteger	a;
        string		b;
        int		c = 0;

        a = BigInteger.Pow(2, 1000);
        b = Convert.ToString(a);

        for (int i = 0; i < b.Length; i++)
            c += b[i] - '0';

        Console.WriteLine("\\n{0}\\n", c);
    }
}


March 20

in me


Your email address will not be published. Required fields are marked *