Last active
May 4, 2019 00:50
-
-
Save yhay81/00ecee170913466badc6aacff37f3b1f to your computer and use it in GitHub Desktop.
Goldbach's comet follows x^(0.8) ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
import numpy as np | |
import pandas as pd | |
from sympy import sieve | |
def prime_doubles(upper): | |
result = [0] * (2 * upper + 1) | |
sieve.extend(upper) | |
max_prime_index, _ = sieve.search(upper) | |
for i in range(1, max_prime_index+1): | |
for j in range(i, max_prime_index+1): | |
result[sieve[i] + sieve[j]] += 1 | |
return result | |
UPPER = 100000 | |
doubles = prime_doubles(UPPER) | |
x = range(6, UPPER, 2) | |
df = pd.DataFrame([doubles[i] for i in x], x, ["patterns by 2 primes"]) | |
df.plot(linestyle='None',marker='o',markersize=0.1) | |
a = 0.8 | |
b = np.array([ 0.058, 0.079, 0.118, 0.162, 0.19, 0.23]) | |
x = np.linspace(0,UPPER,10000) | |
# x = np.logspace(1,5,10000) | |
for i in range(6): | |
y = b[i]*np.power(x, a) | |
plt.plot(x, y) | |
# plt.yscale('log') | |
# plt.xscale('log') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment