Preface
I was playing around with matplotlib to generate some number sequences. I wound up looking at Goldbach pairs and manipulating them in different ways. End result was the following plots. I can't find anything specifically like it online. It reminds me of the prime number spiral video by 3Blue1Brown a few years ago, but not exactly.
I by no means think this is groundbreaking, but like I said, I cannot find any references or figures similar to the one I generated below. I suspect I just don't know what to search for.
Graph explanation
X-Axis : Integers 1-1000
Y-Axis : Goldbach pair as a ratio where the numerator is the smallest number possible for the given integer. Examples just in case I'm not clear:
- 4 = 2+2 : 2/2 = 1
- 6 = 3+3 : 3/3 = 1
- 8 = 3+5 : 3/5 = 0.6
- 9 = 2+7 : 2/7 = 0.28571...
Data points at Y = 0 are numbers that don't have an associated prime pair sums. I could have filtered them out, but I did not.
Observation
The bottom curve (x = 4, 5, 7, 9...) looks to be the sequence prime+2, the next curve to be prime+3, then prime+4, etc.
Questions
Does this pattern have a name? Is there a simple explanation why this pattern emerges from this data set?
Amateur Python Code
import matplotlib.pyplot as plt
def is_prime(num):
if num < 2:
return False
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
return False
return True
def generate_primes(start, end):
primes = [num for num in range(start, end + 1) if is_prime(num)]
return primes
pairs = []
new_pairs = []
q = 0
primes = generate_primes(0,1000)
print(primes)
for i in range(1000):
for x in primes:
for y in primes:
if x + y == i:
pairs.append([x,y])
break
if x + y == i:
break
if x + y != i:
pairs.append([0,i])
continue
for w in pairs:
try:
new_pairs.append([q+1,w[0]/w[1]])
except Exception:
continue
q += 1
x_values, y_values = zip(*new_pairs)
#Plot data point labels
for i, (x, y) in enumerate(zip(x_values, y_values)):
plt.text(x, y, f'{x:.0f}', ha='right', va='bottom')
plt.scatter(x_values, y_values, color='black', marker='o', label='Data Points', s=.5)
plt.xlabel('Integers')
plt.ylabel('Ratio of first Goldbach pair')
plt.legend()
plt.show()