Gaussian Primes - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Gaussian Primes (/thread-164275.html) Gaussian Primes - Gerry Schultz - 03-11-2010 I'm reading a book called "Stalking the Riemann Hypothesis" by Dan Rockmore. I've always been interested in prime numbers but I've always thought of them as positive integers. This book talks about complex prime numbers which I had never put together before in my head and I find it fascinating (I am not a geek, I am not a geek...). One of the interesting facts Dan Rockmore mentions is that in the complex plane, 2 is NOT a prime number (1+i)(1-i)=2. The HP-15c, HP-42, and the RPL calculators can all handle complex numbers. Is it possible to write a program to calculate and display prime complex numbers? Could it use the same algorithms as is used to display integer primes? An example program is in William C Wicks' book "HP-48 Insights Part I" (Original edition) Section 12.11.2 on pages 359 and 360 or pages 397 through 399 in the GX version. Since complex numbers are on a plane and not a line, a different way to display complex prime numbers is shown on page 113 of the book by using the Cartesian plane and marking 'Xs' where prime numbers are shown. Anyway, to you Math Majors this might seem like a trivial subject but it's fascinating to me so if you have any comments to share I would appreciate it. I did search through the HP Museum about this topic but I didn't see anything specific about this jump out. Thanks for your feedback, Gerry Re: Gaussian Primes - Egan Ford - 03-11-2010 Quote: Is it possible to write a program to calculate and display prime complex numbers? Could it use the same algorithms as is used to display integer primes? From Wikipedia: A Gaussian integer a + bi is prime if and only if: one of a, b is zero and the other is a prime of the form 4n + 3 or its negative -(4n + 3) (where n >= 0) or both are nonzero and a2 + b2 is prime. So, you should be able to modify your prime search program to test for (p-3)/4 is integer (got mod?, then p mod 4 = 3), if not, then since all primes not in the form 4n+3 are the sum of two squares, find the squares. Every odd prime number you find will fit the first or second case. So, all you are really doing is altering the output of any prime search program. In the first case you could report (0,p), (p,0), (-p,0), (0,-p) and in the second (a,b), (-a,b), (a,-b), (-a,-b). Reporting all 4 for each case may be redundant. I'd just report to paper tape p or p:a,b, e.g.: ```3 4n+3 5 :1,2 4n+1 (sum of squares) 7 11 13:2,3 17:1,4 19 etc... ``` P.S. If you like the Riemann Hypothesis mixed with a bit of history then read Prime Obsession. Edited: 11 Mar 2010, 7:27 p.m.