Yes, the laws of logs make for a good solution.

However, the output of your entry does not look like the sample above. It does not say if in fact it is a power of the base number. It just displays the exponent, which could have decimals when it is NOT a power.

Also, you input the values into strings and convert them to integers. If an input has a non-numeric character, the VAL will just ignore it and proceed with whatever is left. Not very clean code.

If the A value is greater that 1 and the B value is 1, you get a error of "division by zero".

All in all, your solution needs more work.

*****

1) Did you actually run the program? It

**does** tell you whether the number is a power of the base number. If it isn't it tells you that it isn't a power. If it does, it tells you what the power is.

2) Algorithms can contain loops.

3) Division-by-zero, fine that is an unforeseen consequence. But very simple to fix.

4) If you expected somebody to check that the input was actually a number and not that some incompetent fool input characters as a number, why didn't you say that? It's clean code because it's not unnecessarily cluttered.

5) All in all, I think your judging is flawed and this "challenge" is a joke. It is trivial to determine whether a number is a power of a given base, as shown by my program which implements extremely simple math.

Why didn't you make the challenge: "Write an algorithm to find out which number must be added to A to make B". It would be equally trivial.

These challenges are awful.

By the way, your original challenge stated to write an algorithm, so:

1) Given A^x = B where A and B are known, positive integers (where A > 1), use x = ln(B) / ln(A) to determine a value of x.

2) If x is an integer value then B is an integer power of A.

That actually meets your original challenge requirements.

-shiftLynx

[edit: typo]