Pi-alpha function

From Esolang
Jump to navigation Jump to search

The pi-alpha function is a function that accepts an input and outputs terms that are ratios betwen factorials of primes.

Pi-alpha function

The following is the definition of the pi-alpha function. is the nth prime number.

The following are the values returned by pi-alpha function for the first 5 inputs.

The countably infinite set of values returned by the pi-alpha function is known as the set of pi-alpha numbers. The largest pi-alpha number with a known value is , equal to 0.4192216766963055...

Pi-alpha constant

The pi-alpha constant is an irrational number equal to , or it can be stated that computes the first terms of the pi-alpha constant. However, it is currently uncertain if, as goes to infinity, if converges to some real number or diverges to infinity.

The largest pi-alpha number with a known value, , and the two thousand previous pi-alpha numbers, imply that . This estimate assumes the pi-alpha constant is finite and less than 0.5.

Implementations

The following Python script defines pialpha(n).

def pialpha(n):
    import math
    number = 0
    primes = [2]
    num = 3
    while len(primes) <= n:
        if all(num%i!=0 for i in range(2,int(math.sqrt(num))+1)): # Finds prime numbers
            primes.append(num)
        num += 1
    for i in range(1, n+1): # Calculates the sum
        number += math.factorial(primes[i-1]) / math.factorial(primes[i])
    return number

Languages that cannot compute the pi-alpha function are likely not suitable for practical use.