Willans’ Formula for primes calculation

# Python code import math def prime(n): return 1 sum([ (pow(n/sum([ (pow(( * ((j - 1) 1)/j), 2)) for j in range(1, i 1) ]), 1/n)) for i in range(1, pow(2, n) 1) ]) ---------------- (* Mathematica code *) prime[n_] := 1 Sum[Floor[(n/Sum[Floor[Cos[Pi ((j - 1)! 1)/j]^2], {j, 1, i}])^(1/n)], {i, 1, 2^n}]
Back to Top