# f(i) = 2*i (i<n)
# f(i) = 2*(i-n)+1 = 2*i - (2n-1) (i>=n)
#
# f(i) = (2*i) % (2n-1)
# 1 = (2**60) % (2*n-1)
# 1 != (2**(<60)) % (2*n-1)



def destruct(v):
    arr = []
    for i in range(2,2**32):
        if i*i > v:
            break;
        if v%i != 0:
            continue
        cnt = 0
        while v%i == 0:
            cnt +=1
            v //= i
        arr.append([i,cnt])
    if v > 1:
        arr.append([v,1])
    return arr


def dfs(primes,idx,res,n):
    if idx == len(primes):
        for j in range(1,n):
            if (2**j-1) % res == 0:
                return 0;
        print("ok:",(res+1))
        return (res+1);
    r = 0
    for i in range(primes[idx][1]+1):
        r += dfs(primes,idx+1,res*(primes[idx][0]**i),n)
    return r


def main(n):
    primes = destruct(2**n-1)
    print(primes)
    print("ans:", dfs(primes,0,1,n))

main(8)
main(60)

# def f(i,n,arr):
#     arr.append(i)
#     return (i%n)*2+(i >= n)
#
# def q(n,arr):
#     cnt = 1
#     idx = f(1,n,arr)
#     while idx != 1:
#         cnt +=1
#         idx = f(idx,n,arr)
#     return cnt

