Cody

# Problem 1070. Next Higher Power of B

Solution 1202268

Submitted on 1 Jun 2017 by Tom Holz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(nextpowb(2,126) == 7)

x = 2 x = 4 x = 8 x = 16 x = 32 x = 64 x = 128

2   Pass
assert(nextpowb(3,6560) == 8)

x = 3 x = 9 x = 27 x = 81 x = 243 x = 729 x = 2187 x = 6561

3   Pass
assert(nextpowb(4,262141) == 9)

x = 4 x = 16 x = 64 x = 256 x = 1024 x = 4096 x = 16384 x = 65536 x = 262144

4   Pass
assert(nextpowb(5,21) == 2)

x = 5 x = 25

5   Pass
assert(nextpowb(6,1294) == 4)

x = 6 x = 36 x = 216 x = 1296

6   Pass
assert(nextpowb(7,5) == 1)

x = 7

7   Pass
assert(nextpowb(8,134217726) == 9)

x = 8 x = 64 x = 512 x = 4096 x = 32768 x = 262144 x = 2097152 x = 16777216 x = 134217728

8   Pass
assert(nextpowb(9,4782966) == 7)

x = 9 x = 81 x = 729 x = 6561 x = 59049 x = 531441 x = 4782969

9   Pass
assert(nextpowb(10,99993) == 5)

x = 10 x = 100 x = 1000 x = 10000 x = 100000

10   Pass
assert(nextpowb(11,1771559) == 6)

x = 11 x = 121 x = 1331 x = 14641 x = 161051 x = 1771561

11   Pass
assert(nextpowb(12,429981693) == 8)

x = 12 x = 144 x = 1728 x = 20736 x = 248832 x = 2985984 x = 35831808 x = 429981696

12   Pass
assert(nextpowb(13,2194) == 3)

x = 13 x = 169 x = 2197

13   Pass
assert(nextpowb(14,537814) == 5)

x = 14 x = 196 x = 2744 x = 38416 x = 537824

14   Pass
assert(nextpowb(15,2562890613) == 8)

x = 15 x = 225 x = 3375 x = 50625 x = 759375 x = 11390625 x = 170859375 x = 2.5629e+09

15   Pass
assert(nextpowb(16,249) == 2)

x = 16 x = 256

16   Pass
assert(nextpowb(17,2015993900438) == 10)

x = 17 x = 289 x = 4913 x = 83521 x = 1419857 x = 24137569 x = 410338673 x = 6.9758e+09 x = 1.1859e+11 x = 2.0160e+12

17   Pass
assert(nextpowb(18,3570467226613) == 10)

x = 18 x = 324 x = 5832 x = 104976 x = 1889568 x = 34012224 x = 612220032 x = 1.1020e+10 x = 1.9836e+11 x = 3.5705e+12

18   Pass
assert(nextpowb(19,6131066257790) == 10)

x = 19 x = 361 x = 6859 x = 130321 x = 2476099 x = 47045881 x = 893871739 x = 1.6984e+10 x = 3.2269e+11 x = 6.1311e+12

19   Pass
assert(nextpowb(20,3199997) == 5)

x = 20 x = 400 x = 8000 x = 160000 x = 3200000

20   Pass
assert(nextpowb(21,85766100) == 6)

x = 21 x = 441 x = 9261 x = 194481 x = 4084101 x = 85766121

21   Pass
assert(nextpowb(22,467) == 2)

x = 22 x = 484

22   Pass
assert(nextpowb(23,519) == 2)

x = 23 x = 529

23   Pass
assert(nextpowb(24,2641807540202) == 9)

x = 24 x = 576 x = 13824 x = 331776 x = 7962624 x = 191102976 x = 4.5865e+09 x = 1.1008e+11 x = 2.6418e+12

24   Pass
assert(nextpowb(25,95367431640600) == 10)

x = 25 x = 625 x = 15625 x = 390625 x = 9765625 x = 244140625 x = 6.1035e+09 x = 1.5259e+11 x = 3.8147e+12 x = 9.5367e+13