編制判斷素數(shù)的Sub函數(shù)或者Function函數(shù)嗅义,驗證哥德巴赫猜想:一個不小于6的偶數(shù)可以表示為兩個素數(shù)之和。例如隐砸,6=3+3之碗,8=5+3,10=3+7.【解答】x=int(input("請輸入一個大于或者等于6的偶數(shù):"))def isPrime(val):? ? number=val? ? while number>=6:? ? ? ? if number%2==0:#判斷是否偶數(shù)? ? ? ? ? ? #print(str(number)+"是偶數(shù)")? ? ? ? ? ? a=number? #除數(shù)? ? ? ? ? ? b=a #被除數(shù)? ? ? ? ? ? c=a%b #余數(shù)? ? ? ? ? ? while b>0:? ? ? ? ? ? ? ? #余數(shù)去掉偶數(shù)季希,余數(shù)是0和9的褪那。? ? ? ? ? ? ? ? if? c%2==0 or c==0 or c==9 or (b%5==0 and b>5) or 2*b<a or (b%3==0 and b>3)or (b%7==0 and b>7):? ? ? ? ? ? ? ? ? ? b=b-1? ? ? ? ? ? ? ? ? ? if b==0:? ? ? ? ? ? ? ? ? ? ? ? break? ? ? ? ? ? ? ? ? ? c=a%b? ? ? ? ? ? ? ? ? ? continue? ? ? ? ? ? ? ? print(str(a)+"="+str(b)+"+"+str(c)) #除數(shù)=被除數(shù)+余數(shù)? ? ? ? ? ? ? ? b=b-1? ? ? ? ? ? ? ? if b==0:? ? ? ? ? ? ? ? ? ? break? ? ? ? ? ? ? ? c=a%b? ? ? ? ? ? number=number-1 #輸入數(shù)遞減? ? ? ? else:? ? ? ? ? ? #print(str(number)+"不是偶數(shù)")? ? ? ? ? ? number=number-1? ? ? ? ? ? continue? ? print("輸入的值已經小于6")isPrime(x)