I have an interesting problem where I want to generate a big number (~30000 digits) but it has to be all identical digits, like 66666666666666.......
So far I have done this by:
def fillWithSixes(digits):
    result = 0
    for i in range(digits):
        result *= 10
        result += 6
    return result
However, this is very inefficient, and was wondering if there is any better way? Answer in cpp or java is okay too.
Edit:
- Let's not just solve for - 666666.....I want it to be generic for any number. How about- 7777777777....or- 44444........or- 55555...?
- String operations are worse, the increase from current complexity of - O(n)to- O(n^2).
 
     
     
     
    