Problem 1071. Next Lower Power of B

Created by @bmtran

Given a number n and a base B greater than 1, return the lowest integer power of B that is less than or equal to n.

Example:

    B = 4;
    n = 53;
    npb = lastpowb(B,n);

outputs

    npb = 2

See also: nextpow2, nextpowb

Tags

Problem Group

27 solvers submitted 44 solutions (1.63 solutions/solver).

Problem Comments