Task
Given a base- integer, , convert it to binary (base-). Then find and print the base- integer denoting the maximum number of consecutive 's in 's binary representation. When working with different bases, it is common to show the base as a subscript.
Given a base- integer, , convert it to binary (base-). Then find and print the base- integer denoting the maximum number of consecutive 's in 's binary representation. When working with different bases, it is common to show the base as a subscript.
Code:
import math
import os
import random
import re
import sys
if __name__ == '__main__':
n = int(input())
numbers = str(bin(n)[2:]).split('0')
lenghts = [len(num) for num in numbers]
print(max(lenghts))