I try solve this problem I know that, I can do that like
for i in range(1,input()):
print int(str(i)*i)
It works, but I can\'t use str
I tried doing it this way (notice I took floor division here):
for i in range(1,int(input())):
print(i*((10**i)//9))
for input 5, it yields:
1
22
333
4444
Something that helps here is the equation for a "Repunit". Taking the equation for the i'th Repunit from that Wikipedia page, and substituting 10 in for b (base 10), we get the equation (10**i - 1) / (10 - 1)
or (10**i - 1) / 9
. This results in the sequence: 1, 11, 111, 1111...
. Multiplying by i, we achieve the desired result:
>>> for i in range(1,input()):
... print i * (10**i - 1) / 9
5<Enter>
1
22
333
4444