Euler Problem 63

Ummm, am I missing something here? This worked first try.

public String algorithm ()
    {
        int count = 0;
        for (int power = 1; power <= 100; power++)
        {
            for (int base = 1; base <= 100; base++)
            {
                BigInteger Big = new BigInteger(String.valueOf(base));
                Big = Big.pow(power);
                if (Big.toString().length() == power)
                {
                    count++;
                    v.appendText(String.format("Count:%d Base:%d Power:%d Value:%s\n", count, base, power, Big.toString()));
                }
            }
        }
        return String.format("\nAnswer = %s\n", String.valueOf(count));
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s