Four-digit palindromes start with `[1001,1111,1221,1331,1441,1551,1551,...]` and the number at position `2` is `1111`.  

You will be given two numbers `a` and `b`. Your task is to return the `a-digit` palindrome at position `b` if the palindromes were arranged in increasing order. 

Therefore, `palin(4,2) = 1111`, because that is the second element of the `4-digit` palindrome series.

More examples in the test cases. Good luck!

If you like palindrome Katas, please try:

[Palindrome integer composition](https://www.codewars.com/kata/599b1a4a3c5292b4cc0000d5)

[Life without primes](https://www.codewars.com/kata/59f8750ac374cba8f0000033)

Difficulty: introductory

Starter code:

def palin(a,b):
	

Solutions:
def palin(length, pos):
    left = str(10**((length-1) // 2) + (pos - 1))
    right = left[::-1][length%2:]
    return int(left + right)

def palin(a,b):
    s = str(10**((a-1)//2) + b-1)
    return int(s+s[::-1][a%2:])

def palin(a, b):
    half = str(10**((a + 1) // 2 - 1) + b - 1)
    return int(half + (half[::-1] if a % 2 == 0 else half[:-1][::-1]))

def palin(a,b):
    res = int('1' + ('0' * (a-1))) + 1
    q = a//2
    step = ('1' + (q*'0'), '11'+ ((q-1)*'0'))[a%2==0]
    l = []
    while b>0:
        temp = len(str(res))//2
        res = str(res)
        res = res[:-temp] + res[:temp][::-1]
        if len(res) > a:
            a = len(str(res))
            q = a // 2
            step = ('1' + (q * '0'), '11' + ((q - 1) * '0'))[a % 2 == 0]
        if l and l[-1] == 99:
            l.append(101)
        if res == res[::-1]:
            b-=1
            l.append(int(res))
        res = int(res)
        if str(res + int(step))[:temp-1] != str(res)[:temp-1]:
            temp_res = int(str(res)) + 1
            while str(temp_res) != str(temp_res)[::-1]:
                temp_res += 1
            b -= 1
            if b >= 0:
                l.append(temp_res)
        res += int(step)
    return l[-1]

def palin(a, b):
    base = str(10**((a - 1) // 2) + b - 1)
    return int(base + base[::-1][a % 2:])

def palin(a, b):
    n = (a - 1) // 2
    x, y = divmod(b - 1, 10 ** n)
    result = str(x + 1) + (a > 2) * f'{y:0{n}}'
    return int(result + result[-1 + (a%-2)::-1])

def palin(n,pos):
    half = str(int('1'+'0'*(n//2-int(not n&1)))+pos-1)
    full = int(half + [half,half[:-1]][n&1][::-1]) 
    return full

def palin(a,b):
    l = str(10**((a + 1) // 2 - 1) + b - 1)
    return int(l + (l[::-1] if a % 2 == 0 else l[:-1][::-1]))

from math import ceil
def palin(a,b):
    c=ceil(a/2)
    for i in range(10**(c-1),10**c):
        p=str(i);p+=p[::-1][a%2:]
        if b==1:return int(p)
        else:b-=1

def palin(a,b):
    left = str(10**((a-1)//2)+(b-1))
    right = str(left[::-1][a%2:])
    return int(left+right)