#!/usr/bin/env python # coding: utf-8 # In[1]: from PIL import Image import numpy as np # In[2]: im = Image.open('taiwan.png') # In[3]: arr = np.array(im.convert('L').resize((87,34))) # In[4]: s = "" for i in range(0,arr.shape[0]-1): s0 = "".join("0" if x else "1" for x in arr[i][25:-25]>5) s +=s0 print(s0) W=len(s0) # In[5]: import gmpy2 # In[6]: n = int(s, 2) n = n+1-n%2 gmpy2.is_prime(n) # In[7]: for i in range(len(s)-2,0,-1): if s[len(s)-1-i-1]!=s[len(s)-1-i+1]: # try to change edge only(if not working, comment this line and try again) p = n^(1<