import numpy as np a = [[1,i+2] for i in range(8192)] while len(a) > 1 : a = [[x[0]*y[1]+y[0], x[1]*y[1]] for x,y in zip(a[::2],a[1::2])] s = list(map(int, list(np.base_repr(a[0][0] * (6**10000) // a[0][1], 6)))) q = [1] + [0] * 35 for j in [x*6+y for x,y in zip(s[::2], s[1::2]) ] : if q[j] == 0 : print(j//6+1, j%6+1) q[j] = 1