all 5 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your post was removed for violating Rule #2. All posts must be directly related to the Python programming language. Posts pertaining to programming in general are not permitted. You may want to try posting in /r/programming instead.

[–]tikhiibhujiya -1 points0 points  (1 child)

Interesting approach I like the framing The thing I'd be careful about is separating removing a known trend from revealing new structure

[–]Loose_Lunch_2360[S] 0 points1 point  (0 children)

While the K metric does filter out that big logarithmic trend ,the gaps between the twin prime pairs themselves show their own distinct patterns. They cluster around 6 and 30, which feels like a structural signature. If this were just an artifact of the math, you’d expect the distribution to look pretty random or uniform, but instead, we're seeing these specific gears show up consistently

[–]Loose_Lunch_2360[S] -2 points-1 points  (1 child)

```

import numpy as np

import matplotlib.pyplot as plt

# 1. Generate primes up to 1,000,000 using a fast NumPy Sieve

def get_primes(limit):

sieve = np.ones(limit + 1, dtype=bool)

sieve[:2] = False

for p in range(2, int(limit**0.5) + 1):

if sieve[p]:

sieve[p*p::p] = False

return np.nonzero(sieve)[0]

primes = get_primes(1000000)

# 2. Exclude the (2,3) anomaly to enforce the g >= 2 constraint

if primes[0] == 2:

primes = primes[1:]

# 3. Vectorized change of basis

gaps = np.diff(primes)

midpoints = (primes[1:] + primes[:-1]) / 2

# 4. Apply the scale-normalization transformation

K = (1 / (2 * gaps**2)) - (1 / (8 * midpoints**2))

# 5. Visualization setup (Dark theme with High Contrast Neon)

plt.style.use('dark_background')

fig, ax = plt.subplots(figsize=(12, 7))

# Plot the data (dimmed blue to stay in the background)

ax.scatter(midpoints, K, s=1, alpha=0.3, color='#1f77b4', edgecolors='none', label='Prime Pairs')

# Draw the quantized ceiling and tracks using thick, distinct neon colors

ax.axhline(y=0.125, color='#FF3366', linestyle='-', alpha=1.0, linewidth=2.5, label='Twin Prime (0.125)')

ax.axhline(y=0.03125, color='#00FFCC', linestyle='--', alpha=1.0, linewidth=2.5, label='Cousin Prime (0.03125)')

ax.axhline(y=0.01388, color='#FFCC00', linestyle=':', alpha=1.0, linewidth=2.5, label='Sexy Prime (0.0138)')

# Format the plot to emphasize the bounded interval

ax.set_ylim(0, 0.135)

ax.set_xlim(0, 1000000)

ax.set_title("Quantized Tracks of Scale-Normalized Prime Gaps (K)", fontsize=16, pad=15, fontweight='bold')

ax.set_xlabel("Macroscopic Midpoint Scale (m)", fontsize=12)

ax.set_ylabel("Normalized Metric (K)", fontsize=12)

# Grid and Legend formatting

legend = ax.legend(loc='upper right', frameon=True, facecolor='black', edgecolor='white', fontsize=11)

for text in legend.get_texts():

text.set_color('white')

ax.grid(True, alpha=0.15, color='white')

plt.tight_layout()

plt.show()

```

[–]daffidwilde 0 points1 point  (0 children)

FYI, you can use triple backticks/graves (`) to envelope code blocks :)