How far away is n to the next power of b? – codegolf.stackexchange.com

Let n and b be positive integers larger than 1. Output the distance from n to the next power of b. For n=5 and b=3, the next power of 3 from 5 is 9 (3^2 = 9), so the output is 9 - 5 = 4. For n=8 ...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

Artikel Terkait

0 Comment to "How far away is n to the next power of b? – codegolf.stackexchange.com"