Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Created April 26, 2026 20:15
Show Gist options
  • Select an option

  • Save Hermann-SW/81b8414665d992ddfb87f362a479965b to your computer and use it in GitHub Desktop.

Select an option

Save Hermann-SW/81b8414665d992ddfb87f362a479965b to your computer and use it in GitHub Desktop.
Simplifying prime producing system of 14 diophantine equations on 26 variables for p=2
#!/usr/bin/env wolframscript
(*
based on
https://www.ericzheng.org/files/misc/prime.wl
details
https://www.ericzheng.org/thoughts/prime-polynomial.html
https://www.ericzheng.org/files/pdf/prime.pdf
*)
eq1 = w z + h + j - q
eq2 = (g k + g + k)(h + j) + h - z
eq3 = (2k)^3 (2k + 2) (n + 1)^2 + 1 - f^2
eq4 = p + q + z + 2n - e
eq5 = e^3 (e + 2) (a + 1)^2 + 1 - o^2
eq6 = (a^2 - 1) y^2 - x^2 + 1
(*
eq7+eq8 from original paper
https://www.jstor.org/stable/2318339
*)
eq7 = 16 (a^2-1) r^2 y^4 + 1 - u^2
eq8 = ((a + u^2 (u^2-a))^2 - 1) (n + 4 d y)^2 + 1 - (x + cu)^2
eq9 = (a^2 - 1) l^2 - m^2 + 1
eq10 = k + i (a - 1) - l
eq11 = n + l + v - y
eq12 = p + l (a - n - 1) + b (2a (n + 1) - (n + 1)^2 - 1) - m
eq13 = q + y (a - p - 1) + s (2a (p + 1) - (p + 1)^2 - 1) - x
eq14 = z + p l (a - p) + t (2a p - p^2 - 1) - p m
a = 7901690358098896161685556879749949186326380713409290912
b = 0
e = 32
f = 17
g = 0
h = 2
i = 0
j = 5
k = 1 (* note k = 0 in the polynomial, but k = 1 here *)
l = 1
m = a
n = 2
o = 8340353015645794683299462704812268882126086134656108363777
p = 3
q = 16
s = 1
t = 0
v = 2a - 3
w = 1
x = 2a^2 - 1
y = 2a
z = 9
S=Simplify[{eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9, eq10, eq11, eq12, eq13, eq14}]
Print[S[[7]]==0]
Print[S[[8]]==0]
@Hermann-SW
Copy link
Copy Markdown
Author

Largest constant has 332 decimal digits, remaining two equations have variables c, d, r and u left unfixed:

pi@raspberrypi5:~ $ wolframscript -f diophantine.primes.cdru.wl 
1 + 62310323747746783753154871274856948810697778984899518624340072221305858194676925305194413689906975010766679814949029450382905632490521084141729062190213501628290192909949095484073533946150864915984334572822465206151554242507712039047165418296460084078356392668379830509339015989922355433080757000533565286762919005360778364466495488*r^2 - u^2 == 0
1 - (124873421030546123716955456199915227363498042625369404787663046068861824030537771349337505905066959125291583487 + cu)^2 + (2 + 63213522864791169293484455037999593490611045707274327296*d)^2*(-1 + (7901690358098896161685556879749949186326380713409290912 - 7901690358098896161685556879749949186326380713409290912*u^2 + u^4)^2) == 0
pi@raspberrypi5:~ $ 

@Hermann-SW
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment