2023.04.07 Math 3600 Goldbach

167 days ago by calkin

Goldbach's  conjecture: every even integer $n>2$ can be written as the sum of two primes.

How should we investigate this conjecture?

First let's construct a list of odd primes up to $N$, say.

N=10000 prime_list=[] for i in srange(3,N): if is_prime(i): prime_list.append(i) 
       
print(prime_list) 
       
[3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
71, 73, 79, 83, 89, 97]
[3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
birthdays={"January":3,"February":1} 
       
print(birthdays) 
       
{'January': 3, 'February': 1, 'March': 2}
{'January': 3, 'February': 1, 'March': 2}
birthdays["March"]=2 birthdays["April"]=1 birthdays["May"]=1 birthdays["June"]=0 birthdays["July"]=0 birthdays["August"]=1 birthdays["September"]=1 birthdays["October"]=4 birthdays["November"]=1 birthdays["December"]=0 
       
print(birthdays) 
       
{'February': 1, 'October': 4, 'March': 2, 'August': 1, 'May': 1,
'January': 3, 'June': 0, 'September': 1, 'April': 1, 'December': 0,
'July': 0, 'November': 1}
{'February': 1, 'October': 4, 'March': 2, 'August': 1, 'May': 1, 'January': 3, 'June': 0, 'September': 1, 'April': 1, 'December': 0, 'July': 0, 'November': 1}
birthdays.has_key("Marc") 
       
False
False
goldbach_dict={} for p in prime_list: for q in prime_list: n=p+q if goldbach_dict.has_key(n): goldbach_dict[n]+=1 else: goldbach_dict[n]=1 
       
print(goldbach_dict) 
       
{6: 1, 8: 2, 10: 3, 12: 2, 14: 3, 16: 4, 18: 4, 20: 4, 22: 5, 24: 6, 26:
5, 28: 4, 30: 6, 32: 4, 34: 7, 36: 8, 38: 3, 40: 6, 42: 8, 44: 6, 46: 7,
48: 10, 50: 8, 52: 6, 54: 10, 56: 6, 58: 7, 60: 12, 62: 5, 64: 10, 66:
12, 68: 4, 70: 10, 72: 12, 74: 9, 76: 10, 78: 14, 80: 8, 82: 9, 84: 16,
86: 9, 88: 8, 90: 18, 92: 8, 94: 9, 96: 14, 98: 6, 100: 12, 102: 16,
104: 8, 106: 7, 108: 12, 110: 8, 112: 8, 114: 12, 116: 6, 118: 5, 120:
14, 122: 3, 124: 4, 126: 12, 128: 4, 130: 6, 132: 8, 134: 5, 136: 4,
138: 6, 140: 6, 142: 5, 144: 6, 146: 3, 148: 2, 150: 8, 152: 2, 154: 2,
156: 6, 158: 3, 160: 2, 162: 4, 164: 2, 166: 1, 168: 4, 170: 2, 172: 2,
176: 2, 178: 1, 180: 2, 186: 2, 194: 1}
{6: 1, 8: 2, 10: 3, 12: 2, 14: 3, 16: 4, 18: 4, 20: 4, 22: 5, 24: 6, 26: 5, 28: 4, 30: 6, 32: 4, 34: 7, 36: 8, 38: 3, 40: 6, 42: 8, 44: 6, 46: 7, 48: 10, 50: 8, 52: 6, 54: 10, 56: 6, 58: 7, 60: 12, 62: 5, 64: 10, 66: 12, 68: 4, 70: 10, 72: 12, 74: 9, 76: 10, 78: 14, 80: 8, 82: 9, 84: 16, 86: 9, 88: 8, 90: 18, 92: 8, 94: 9, 96: 14, 98: 6, 100: 12, 102: 16, 104: 8, 106: 7, 108: 12, 110: 8, 112: 8, 114: 12, 116: 6, 118: 5, 120: 14, 122: 3, 124: 4, 126: 12, 128: 4, 130: 6, 132: 8, 134: 5, 136: 4, 138: 6, 140: 6, 142: 5, 144: 6, 146: 3, 148: 2, 150: 8, 152: 2, 154: 2, 156: 6, 158: 3, 160: 2, 162: 4, 164: 2, 166: 1, 168: 4, 170: 2, 172: 2, 176: 2, 178: 1, 180: 2, 186: 2, 194: 1}
list_plot(goldbach_dict) 
       
Traceback (click to the left of this block for traceback)
...
TypeError: unhashable type
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_33.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bGlzdF9wbG90KGdvbGRiYWNoX2RpY3RbOjEwMDAwXSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpRpIjUb/___code___.py", line 3, in <module>
    exec compile(u'list_plot(goldbach_dict[:_sage_const_10000 ])
  File "", line 1, in <module>
    
TypeError: unhashable type
goldbach_list=[] for n in srange(2,N+1): if goldbach_dict.has_key(n): goldbach_list.append([n,goldbach_dict[n]]) 
       
list_plot(goldbach_list) 
       
N=10000 prime_list=[] for i in srange(3,N): if is_prime(i): prime_list.append(i) goldbach_dict={} for p in prime_list: for q in prime_list: n=p+q if goldbach_dict.has_key(n): goldbach_dict[n]+=1 else: goldbach_dict[n]=1 goldbach_list=[] for n in srange(2,N+1): if goldbach_dict.has_key(n): goldbach_list.append([n,goldbach_dict[n]]) 
       
A=list_plot(goldbach_list) 
       
for i in srange(5000): if goldbach_dict.has_key(2*i)==False: print(2*i) 
       
0
2
4
0
2
4

This computation suggests that the Goldbach conjecture is true.

max=0 champions=[] for n in srange(N): if goldbach_dict.has_key(n): if goldbach_dict[n]>max: max=goldbach_dict[n] champions.append([n,max]) 
       
list_plot(champions) 
       
print(champions) 
       
[[6, 1], [8, 2], [10, 3], [16, 4], [22, 5], [24, 6], [34, 7], [36, 8],
[48, 10], [60, 12], [78, 14], [84, 16], [90, 18], [114, 20], [120, 24],
[168, 26], [180, 28], [210, 38], [300, 42], [330, 48], [390, 54], [420,
60], [510, 64], [630, 82], [780, 88], [840, 102], [990, 104], [1050,
114], [1140, 116], [1260, 136], [1470, 146], [1650, 152], [1680, 166],
[1890, 182], [2100, 194], [2310, 228], [2730, 256], [3150, 276], [3570,
308], [3990, 326], [4200, 330], [4410, 342], [4620, 380], [5250, 396],
[5460, 436], [6090, 444], [6510, 482], [6930, 536], [7980, 548], [8190,
584], [9030, 606], [9240, 658]]
[[6, 1], [8, 2], [10, 3], [16, 4], [22, 5], [24, 6], [34, 7], [36, 8], [48, 10], [60, 12], [78, 14], [84, 16], [90, 18], [114, 20], [120, 24], [168, 26], [180, 28], [210, 38], [300, 42], [330, 48], [390, 54], [420, 60], [510, 64], [630, 82], [780, 88], [840, 102], [990, 104], [1050, 114], [1140, 116], [1260, 136], [1470, 146], [1650, 152], [1680, 166], [1890, 182], [2100, 194], [2310, 228], [2730, 256], [3150, 276], [3570, 308], [3990, 326], [4200, 330], [4410, 342], [4620, 380], [5250, 396], [5460, 436], [6090, 444], [6510, 482], [6930, 536], [7980, 548], [8190, 584], [9030, 606], [9240, 658]]
champions_ratio=[] for i in champions: champions_ratio.append([i[0],i[1]/i[0]]) 
       
list_plot(champions_ratio) 
       
goldbach3_list=[] for n in srange(1,N/6): goldbach3_list.append([6*n,goldbach_dict[6*n]/2]) 
       
B=list_plot(goldbach3_list,color='red') 
       
show(A+B) 
       
Traceback (click to the left of this block for traceback)
...
NameError: name 'A' is not defined
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_3.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("c2hvdyhBK0Ip"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmphO_J72/___code___.py", line 2, in <module>
    exec compile(u'show(A+B)
  File "", line 1, in <module>
    
NameError: name 'A' is not defined

How many primes are there congruent to 1 mod 6?  How many congruent to 5 mod 6?

prime1=[] prime5=[] p=5 while p<1000000: if p%6==1: prime1.append(p) if p%6==5: prime5.append(p) p=next_prime(p) print(len(prime1), len(prime5)) 
       
(39231, 39265)
(39231, 39265)

How do we compute

\[ HL(n) = \prod_{p \mbox{odd}, p|n}  \frac{p-1}{p-2} \]

def HL(n): L=factor(2*n) # make sure 2 is always a factor, to make it easy to ignore x=1 for i in srange(1,len(L)): p=L[i][0] x=x*(p-1)/(p-2) return(x) 
       
HL(105) 
       
16/5
16/5
corrected_list=[] for x in goldbach_list: n=x[0] r=x[1]/HL(n) corrected_list.append([n,r]) 
       
A=list_plot(corrected_list) 
       
corrected_list[:5] 
       
[[6, 1/2], [8, 2], [10, 9/4], [12, 1], [14, 5/2]]
[[6, 1/2], [8, 2], [10, 9/4], [12, 1], [14, 5/2]]
B=list_plot(goldbach_list,color='red') 
       
show(B+A) 
       
show(A) 
       
C=plot(1.7*t/log(t)^2,t,2,10000,color='red') 
       
show(A+C) 
       
def fermat(n): return(2^(2^n)+1) 
       
fermat(4) 
       
65537
65537
factor(fermat(4)) 
       
65537
65537
n=fermat(5) 
       
n.is_prime() 
       
False
False
n.factor() 
       
641 * 6700417
641 * 6700417