You are given a positive integer $N$. 

Your task is to print a palindromic triangle of size $N$.  

For example, a palindromic triangle of size $5$ is:  

1
121
12321
1234321
123454321

You can't take more than two lines. The first line (a for-statement) is already written for you. 

You have to complete the code using exactly one print statement.  

Note: 

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

Using more than one for-statement will give a score of $\mbox{0}$.

Input Format

A single line of input containing the integer $N$.  

Constraints

$0<N<10$

Output Format

Print the palindromic triangle of size $N$ as explained above.

Sample Input
5

Sample Output
1
121
12321
1234321
123454321

Source: hackerrank | Difficulty: MEDIUM
Tags: Mathematics


Solutions:
for i in range(1, int(input()) + 1):
	print({1: 1, 2: 121, 3: 12321, 4: 1234321, 5: 123454321, 6: 12345654321, 7: 1234567654321, 8: 123456787654321, 9: 12345678987654321}[i])


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


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


for i in range(1, int(input()) + 1):
	print((lambda n: (lambda f, n: f(f, n))(lambda f, n: f(f, n - 1) // 10 ** (n - 2) * 10 ** n + n * 10 ** (n - 1) + f(f, n - 1) % 10 ** (n - 1) if n > 1 else 1, n))(i))


for i in range(1, int(input()) + 1):
	print(sum(map(lambda x, y: x * y, list(map(lambda x: 10 ** x, range(2 * i + 1))), list(range(1, i)) + [i] + list(range(i - 1, 0, -1)))))


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


for i in range(1, int(input()) + 1):
	print(sum(map(lambda t: t * 10 ** (2 * i - t - 1), range(1, i))) + sum(map(lambda t: t * 10 ** (t - 1), range(i, 0, -1))))


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


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


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


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


for i in range(1, int(input()) + 1):
	print((lambda a: lambda v: a(a, v))(lambda s, x: 1 if x == 0 else 10 ** x + s(s, x - 1))(i - 1) ** 2)


for i in range(1, int(input()) + 1):
	print([1, 121, 12321, 1234321, 123454321, 12345654321, 1234567654321, 123456787654321, 12345678987654321][i - 1])


suma = 1
for i in range(1, int(input()) + 1):
	print(suma ** 2)
	suma = suma * 10 + 1


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


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


for i in range(1, int(input()) + 1):
	print(sum(map(lambda x: x * 10 ** (2 * i - x - 1) if x <= i else (2 * i - x) * 10 ** (2 * i - x - 1), range(1, 2 * i))))


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


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


for i in range(1, int(input()) + 1):
	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)) ** 2)


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


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


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


for i in range(1, int(input()) + 1):
	print((i == 1) * 1 + (i == 2) * 121 + (i == 3) * 12321 + (i == 4) * 1234321 + (i == 5) * 123454321 + (i == 6) * 12345654321 + (i == 7) * 1234567654321 + (i == 8) * 123456787654321 + (i == 9) * 12345678987654321)


for i in range(1, int(input()) + 1):
	print(1 if i == 1 else 121 if i == 2 else 12321 if i == 3 else 1234321 if i == 4 else 123454321 if i == 5 else 12345654321 if i == 6 else 1234567654321 if i == 7 else 123456787654321 if i == 8 else 12345678987654321)


for i in range(1, int(input()) + 1):
	print(sum(map(lambda a: a[0] * 10 ** a[1], zip(list(range(1, i)) + list(range(i, 0, -1)), range(i * 2 - 1)))))


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


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


for i in range(1, int(input()) + 1):
	print(pow(sum(map(pow, [10] * i, list(range(i)))), 2))


for i in range(1, int(input()) + 1):
	print(sum(map(lambda x: x[1] * 10 ** (2 * (i - 1) - x[0]), enumerate(list(range(1, i)) + list(range(i, 0, -1))))))


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


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


for i in range(1, int(input()) + 1):
	print(sum(map(pow, [10] * i, range(i))) ** 2)


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


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


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


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


for i in range(1, int(input()) + 1):
	print((10 ** (i - 1) // 1 + 10 ** (i - 1) // 10 + 10 ** (i - 1) // 100 + 10 ** (i - 1) // 1000 + 10 ** (i - 1) // 10000 + 10 ** (i - 1) // 100000 + 10 ** (i - 1) // 1000000 + 10 ** (i - 1) // 10000000 + 10 ** (i - 1) // 100000000 + 10 ** (i - 1) // 1000000000) ** 2)


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


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


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


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


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


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


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


for i in range(1, int(input()) + 1):
	print(sum(map(lambda x, y: x * 10 ** y, list(range(1, i)) + [i] + list(range(i - 1, 0, -1)), list(range((i - 1) * 2, -1, -1)))))


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


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


for i in range(1, int(input()) + 1):
	print(10 ** (i - 1) * (lambda n: n < i and (lambda s, n: n < i and (lambda s, n: n < i and (lambda s, n: n < i and (lambda s, n: n < i and (lambda s, n: n < i and (lambda s, n: n < i and (lambda s, n: n < i and (lambda s, n: s + n)(10 * s + 10 * n, n + 1) or s + n)(10 * s + 10 * n, n + 1) or s + n)(10 * s + 10 * n, n + 1) or s + n)(10 * s + 10 * n, n + 1) or s + n)(10 * s + 10 * n, n + 1) or s + n)(10 * s + 10 * n, n + 1) or s + n)(10 * s + 10 * n, n + 1) or s + n)(n * 10, n + 1) or n)(1) + (lambda n: n and (lambda s, n: n and (lambda s, n: n and (lambda s, n: n and (lambda s, n: n and (lambda s, n: n and (lambda s, n: n and (lambda s, n: n and (lambda s, n: s)(10 * s + n, n - 1) or s)(10 * s + n, n - 1) or s)(10 * s + n, n - 1) or s)(10 * s + n, n - 1) or s)(10 * s + n, n - 1) or s)(10 * s + n, n - 1) or s)(10 * s + n, n - 1) or s)(n, n - 1) or 0)(i - 1))


for i in range(1, int(input()) + 1):
	print([0, 1, 121, 12321, 1234321, 123454321, 12345654321, 1234567654321, 123456787654321, 12345678987654321][i])


for i in range(1, int(input()) + 1):
	print(sum(list(map(lambda k: k[0] * 10 ** k[0] if k[1] < 0 else (i - k[1]) * 10 ** k[0], list(enumerate(list(range(-i, i))))))) // 10)