By Daniel · December 26, 2008
Tests whether n is a power of base; more precisely, whether there exists some power p such that base^p = n.
/* is_power(n, base) * * Tests whether n is a power of base; more precisely, whether there exists * some power p such that base^p = n. */ if (argument0 == 0) return (argument1 == 0); if (argument1 == 0) return (argument0 == 1) * -1; if (argument1 == 1) return (argument0 == 1); return ((logn(argument1, argument0) mod 1) == 0);
Categories: Mathematics
There are no comments to display.
You must be signed in to post comments.