You are given a positive integer $N$. Print a numerical triangle of height $N-1$ like the one below:  

1
22
333
4444
55555
......

Can you do it using only arithmetic operations, a single for loop and print statement?  

Use no more than two lines. The first line (the for statement) is already written for you. You have to complete the print statement.  

Note: Using anything related to strings will give a score of $\mbox{0}$.  

Input Format 

A single line containing integer, $N$.  

Constraints 

$1\leq N\leq9$  

Output Format 

Print $N-1$ lines as explained above.  

Sample Input  

5

Sample Output  

1
22
333
4444

Source: hackerrank | Difficulty: MEDIUM
Tags: Mathematics


Solutions:
for i in range(1, int(input())):
	print(1 if i == 1 else 22 if i == 2 else 333 if i == 3 else 4444 if i == 4 else 55555 if i == 5 else 666666 if i == 6 else 7777777 if i == 7 else 88888888 if i == 8 else 999999999)


for i in range(1, int(input())):
	print(i * (111111111111111111111 // 10 ** (21 - i)))


for i in range(1, int(input())):
	print(i * 10 ** (i - 1) + (i * 10 ** (i - 2) if i - 2 >= 0 else 0) + (i * 10 ** (i - 3) if i - 3 >= 0 else 0) + (i * 10 ** (i - 4) if i - 4 >= 0 else 0) + (i * 10 ** (i - 5) if i - 5 >= 0 else 0) + (i * 10 ** (i - 6) if i - 6 >= 0 else 0) + (i * 10 ** (i - 7) if i - 7 >= 0 else 0) + (i * 10 ** (i - 8) if i - 8 >= 0 else 0) + (i * 10 ** (i - 9) if i - 9 >= 0 else 0))


for i in range(1, int(input())):
	print(111111111 * i % 10 ** i)


for i in range(1, int(input())):
	print([0, 1, 22, 333, 4444, 55555, 666666, 7777777, 88888888, 999999999][i])


for i in [1, 22, 333, 4444, 55555, 666666, 7777777, 88888888, 999999999][:int(input()) - 1]:
	print(i)


for i in range(1, int(input())):
	print(i * (100000000 * int(bool(i // 9)) + 10000000 * int(bool(i // 8)) + 1000000 * int(bool(i // 7)) + 100000 * int(bool(i // 6)) + 10000 * int(bool(i // 5)) + 1000 * int(bool(i // 4)) + 100 * int(bool(i // 3)) + 10 * int(bool(i // 2)) + 1))


for i in range(1, int(input())):
	print(int(i * (111111111 / 10 ** (9 - i))))


for i in range(1, int(input())):
	print(int(i * (1 / 9) * 10 ** i))


for i in range(1, int(input())):
	print(i * int(bin(2 ** i - 1)[2:]))


for i in range(1, int(input())):
	print(chr(i + 48) * i)


for i in range(1, int(input())):
	print(repr(i) * i)


for i in range(1, int(input())):
	print(sum(list(map(lambda v: 10 ** v, range(0, i)))) * i)


for i in range(1, int(input())):
	print(i * (1111111111 % 10 ** i))


for i in range(1, int(input())):
	print(i * 11111111 % 10 ** i)


for i in range(1, int(input())):
	print(i * (11111111 % 10 ** i))


for i in range(1, int(input())):
	print(1 if i < 2 else 22 if i < 3 else 333 if i < 4 else 4444 if i < 5 else 55555 if i < 6 else 666666 if i < 7 else 7777777 if i < 8 else 88888888)


for i in range(1, int(input())):
	print(i * int(chr(49) * i))


for i in range(1, int(input())):
	print(int(i * 1.11111111111 * 10 ** (i - 1)))


for i in range(1, int(input())):
	print(int(i * pow(10, i) / 9))


for i in range(1, int(input())):
	print(int(1.0 / 9 * pow(10, i)) * i)


for i in range(1, int(input())):
	print(i * 111111111 % 10 ** i)


for i in range(1, int(input())):
	print(int(pow(10, i - 1) * i + pow(10, i - 2) * i + pow(10, i - 3) * i + pow(10, i - 4) * i + pow(10, i - 5) * i + pow(10, i - 6) * i + pow(10, i - 7) * i + pow(10, i - 8) * i + pow(10, i - 9) * i))


for i in range(1, int(input())):
	print(sum(list(map(lambda x: i * 10 ** x, range(0, i)))))


for i in range(1, int(input())):
	print(i * (111111111111 % 10 ** i))


for n in range(1, int(input())):
	print([0, 1, 22, 333, 4444, 55555, 666666, 7777777, 88888888, 999999999][n])


for i in range(1, int(input())):
	print(i * (10 ** i - 1) // 9)


for i in range(1, int(input())):
	print(i * (1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111)[i - 1])


for i in range(1, int(input())):
	print(int(1 / 9 * i * 10 ** i))


for i in range(1, int(input())):
	print((lambda f, n: f(f, n))(lambda f, n: i if n == 0 else 10 ** n * i + f(f, n - 1), i - 1))


for i in range(1, int(input())):
	print(sum(map(lambda x: i * 10 ** x, range(i))))


for i in range(1, int(input())):
	print(sum(map(lambda n, i=i: i * 10 ** n, range(i))))


for i in range(1, int(input())):
	print(11111111111 % 10 ** i * i)


for i in range(1, int(input())):
	print(int(i * (1 * (1 - 10 ** i) / (1 - 10))))


for i in range(1, int(input())):
	print(int(bin(2 ** i - 1)[2:]) * i)


for i in range(1, int(input())):
	print(int(i * (10 ** i - 1) / 9))


for i in range(1, int(input())):
	print(11111111111111111111111111111111111111111111111111111111111111111111111 * i % pow(10, i))


for i in range(1, int(input())):
	print(10 ** i // 9 * i)


for i in range(1, int(input())):
	print(sum(map(lambda j: i * 10 ** j, range(i))))


for i in range(1, int(input())):
	print(int(10 ** (i - 1) * 1.1111111111) * i)


for i in range(1, int(input())):
	print(int(10 ** i / 9) * i)


for i in range(1, int(input())):
	print(1111111111 % 10 ** i * i)


for i in range(1, int(input())):
	print(int(i * 10 ** (i - 1) + i * 10 ** (i - 2) + i * 10 ** (i - 3) + i * 10 ** (i - 4) + i * 10 ** (i - 5) + i * 10 ** (i - 6) + i * 10 ** (i - 7) + i * 10 ** (i - 8) + i * 10 ** (i - 9)))


for i in range(1, int(input())):
	print(int(i * (10 ** (i - 1) + 10 ** (i - 2) + 10 ** (i - 3) + 10 ** (i - 4) + 10 ** (i - 5) + 10 ** (i - 6) + 10 ** (i - 7) + 10 ** (i - 8)) // 1))


for i in range(1, int(input())):
	print(hex(i)[2:] * i)


for i in range(1, int(input())):
	print(i * (111111111 % pow(10, i)))


for i in range(1, int(input())):
	print(int(i * (10 ** (i - 1) + 10 ** (i - 2) + 10 ** (i - 3) + 10 ** (i - 4) + 10 ** (i - 5) + 10 ** (i - 6) + 10 ** (i - 7) + 10 ** (i - 8) + 10 ** (i - 9))))


for i in range(1, int(input())):
	print(int(10 / 9 * 10 ** (i - 1) * i))


import math
for i in range(1, int(input())):
	print(i * math.floor(pow(10, i - 1)) + i * math.floor(pow(10, i - 2)) + i * math.floor(pow(10, i - 3)) + i * math.floor(pow(10, i - 4)) + i * math.floor(pow(10, i - 5)) + i * math.floor(pow(10, i - 6)) + i * math.floor(pow(10, i - 7)) + i * math.floor(pow(10, i - 8)) + i * math.floor(pow(10, i - 9)))


for i in range(1, int(input())):
	print(i * (111111111 % 10 ** i))


for i in range(1, int(input())):
	print((pow(10, i) - 1) // 9 * i)


for i in range(1, int(input())):
	print(int(111111111 / pow(10, 9 - i)) * i)


for i in range(1, int(input())):
	print(int(1 / 9 * 10 ** i // 1 * i))


for i in range(1, int(input())):
	print(int(10 ** (i - 1) + 10 ** (i - 2) + 10 ** (i - 3) + 10 ** (i - 4) + 10 ** (i - 5) + 10 ** (i - 6) + 10 ** (i - 7) + 10 ** (i - 8) + 10 ** (i - 9)) * i)


for i in range(1, int(input())):
	print(i * sum(map(lambda x: 10 ** x, range(i))))


for i in range(1, int(input())):
	print(int(10 ** (i - 1) * i) + int(10 ** (i - 2) * i) + int(10 ** (i - 3) * i) + int(10 ** (i - 4) * i) + int(10 ** (i - 5) * i) + int(10 ** (i - 6) * i) + int(10 ** (i - 7) * i) + int(10 ** (i - 8) * i) + int(10 ** (i - 9) * i))


for i in range(1, int(input())):
	print(int(i * pow(10, i - 1)) + int(i * pow(10, i - 2)) + int(i * pow(10, i - 3)) + int(i * pow(10, i - 4)) + int(i * pow(10, i - 5)) + int(i * pow(10, i - 6)) + int(i * pow(10, i - 7)) + int(i * pow(10, i - 8)) + int(i * pow(10, i - 9)))


for i in range(1, int(input())):
	print([1, 22, 333, 4444, 55555, 666666, 7777777, 88888888][i - 1])


for i in range(1, int(input())):
	print(i * int(pow(10, i - 1)) + i * int(pow(10, i - 2)) + i * int(pow(10, i - 3)) + i * int(pow(10, i - 4)) + i * int(pow(10, i - 5)) + i * int(pow(10, i - 6)) + i * int(pow(10, i - 7)) + i * int(pow(10, i - 8)) + i * int(pow(10, i - 9)))


for i in range(1, int(input())):
	print(int(i * 10 ** (i - 1) + i * 10 ** (i - 2) // 1 + i * 10 ** (i - 3) // 1 + i * 10 ** (i - 4) // 1 + i * 10 ** (i - 5) // 1 + i * 10 ** (i - 6) // 1 + i * 10 ** (i - 7) // 1 + i * 10 ** (i - 8) // 1 + i * 10 ** (i - 9) // 1))


for i in range(1, int(input())):
	print(111111111 * i // 10 ** (9 - i))


for i in range(1, int(input())):
	print(111111111 % 10 ** i * i)


for i in range(1, int(input())):
	print([1, 22, 333, 4444, 55555, 666666, 7777777, 88888888, 999999999][i - 1])


for i in range(1, int(input())):
	print(i * 111111111 // 10 ** (9 - i))


for i in range(1, int(input())):
	print((10 ** i - 1) // 9 * i)


for i in range(1, int(input())):
	print(sum(map(lambda x: x[0] * 10 ** x[1], zip((i,) * i, range(i)))))