I am exploring a mathematical function related to prime numbers and have written a Python script to test it. Here is the function and the code I've used:
Math Functions:
- Sum of Divisors Function:
$$ \sigma(n) = \sum_{i=1}^{n} i, \quad \text{where } i \text{ is a divisor of } n.$$
- Function $ r(x) $:
$$ r(x) = \sigma(x) - x,$$
where $\sigma(x) $ is the sum of divisors of $ x$.
- Function $p(t, r)$:
$$ p(t, r) = e^{r \sin \left( \frac{(2t+1) \pi}{2} \right)}$$
Python Code:
import math
import cmath
def sum_of_divisors(n):
# Calculate the sum of divisors σ(n)
return sum(i for i in range(1, n + 1) if n % i == 0)
def r_function(x):
# Calculate r(x) = σ(x) - x
return sum_of_divisors(x) - x
def calculate_p(t, r):
# Calculate p(t, r) using the given exponent formula
exponent = r * cmath.sin((2 * t + 1) * math.pi / 2)
return cmath.exp(exponent)
# Generate r values and calculate p(t, r)
x_values = range(1, 100) # Adjust range as needed
results = []
for x in x_values:
r = r_function(x)
t = 1 # You can adjust this or loop through different t values
p = abs(calculate_p(t, r))
results.append((x, r, p))
# Print results
for x, r, p in results:
print(f"x = {x}, r = σ({x}) - {x} = {r}, p = {p:.6f}")
Observations:
- Whenever $x$ is a prime number, $r(x) = 1$, and consequently, $p(t, r) \approx 0.367879$ (which is close to $e^{-1}$.
- For non-prime $x$, $r(x) > 1$, and the value of $p(t, r)$ tends to $0$ rapidly.
Question:
Can the function $p(t, r)$ be formally used to identify prime numbers? Specifically:
Is there a better way to use $r$, or a closed form equation instead of $r(x) = \sigma(x) - x$? The better way should atleast achieve one of: a. Be closed form. b. Gives a prime generating function directly.
Can we generate other significant sequences other than the prime numbers sequence by choosing $r$, which ones?
Edit 1: $$p(x) = e^{-\frac{\sin\left(\frac{(x \pi)}{\log(x)}\right)}{\pi}}.$$ Is amazingly intereting!