Pi-alpha function
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. Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle p_{n}} 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, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \pi_{\alpha}(3000)} , and the two thousand previous pi-alpha numbers, imply that Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \pi_{\alpha}=0.41922...} . This estimate assumes the pi-alpha constant is finite and less than 0.5.
Implementations
Python
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.
MoreMathRPN
This was a very good puzzle! The hardest task here is calculating A40(n)
inputR floor hold input del 0 2 3 5 0 repeat $input 1 repeat ]4 >>> 0 * next repeat ]3 >>> 0 / next + >>> 0 1 + -> 2 repeat ]1 >> 0 >> 2 5 + >>> 0 - >> ]0 del 1 % step 2 * jmp ]0 leap 8 del 0 next "Prime! del 1 >> 0 <- 2 2 + <- 1 jmp 5 del 0 2 + jmp -27 next outputV