Eisenstein-Jacobi Prime Integer Pair - Finding 'a' and 'b'

This Programme code-suite is about Eisenstein-Jacobi Prime Integer Pair.
Updated 2 Jun 2005

No License

Consider a prime p = 99999931. This can be expressed in 3 different ways as :

p = 99999931 = 11159^2 + 8150^2 - 11159 * 8150
p = 99999931 = 11159^2 + 3009^2 - 11159 * 3009
p = 99999931 = 8150^2 + 3009^2 + 8150 * 3009 % Note ?+? here in the last term

How did we get this ?
Ans : That is the Theory of Eisenstein-Jacobi Prime Integer Pair (E-J Prime Int Pairs for brevity).

This Programme code-suite is about Eisenstein-Jacobi Prime Integers. (NOT Einstein !)

The Literature References are :
and http://mathworld.wolfram.com/EisensteinPrime.html

Eisenst_Jcbi_Prm_Int_1.m is the main Programme of this code-suite.
The idea in this pgm is to find the pair of integers "a" and "b" which result in an Eisenstein-Jacobi Prime Integer.
The equivalent of Fermat's Theorem for E-J Prime Int Pairs is as foll :
A Prime No p which is such that (p+1) is NOT divisible by 3 can be expressed using an E-J Prime Int Pair as :
p = (a + b*w) * ( a + b*w^2) = a^2 + b^2 ? a*b
where w is the cube root of 1
ie, w reps the solution for the Poly : x^3 - 1 = 0.

In simpler words, given a Prime No p which is such that (p+1) is NOT divisible by 3, it is possible to find a pair of Integers "a" and "b" such that
p = (a + b*w) * ( a + b*w^2) = a^2 + b^2 ? a*b

Because of the Quadratic Eqn in "b" that we need to solve, we get 2 values of b.
Let me explain the foll with an example :
Consider p = 283 ; This gives a = 13 ; b = [19, -6]
It can be seen that b1 = 19 ; b2 = +6 also is an E-J Prime Int Pair ie, :
p = 283 = (19 + 6*w) * (19 + 6*w^2) = 19^2 + 6^2 - 19*6

Take another example : p = 9967 ; we get : a = 109 ; b = [ 87, 22 ]
First verify that : 9967 = 109^2 + 87^2 - 109 * 87
Then, verify also that "b1, -b2" is an E-J Prime Int Pair ! :
9967 = 87^2 + 22^2 + 87*22

Thus, in general, it can be seen that if "a, b1" and "a, b2" are E-J Prime Int Pairs, and if say, b1 > b2, then, "b1, -b2" is also an E-J Prime Int Pair !
Thus effectively, we have 3 basic pairs of solutions for a given prime p.

In the main programme, I have attempted to calculate ?a? by a smarter approach ; I have observed that integer "a" hovers slightly above sqrt(sel_Prime).


Eisenst_Jcbi_Prm_Int_1_TEST.m is an accompanying Programme that contains a suite of very detailed testing code

I have checked the continuous range upto prime p = 74413 (N = 2000000), and in steps, upto prime p = 5489221 (N approx = 6.5e7) ; also, many spot checks have been made at selected primes including at Matlab's approx max prime limit ~ 99999931.


Another accompanying Pgm E_J_Rev_Prime_Chk.m is a rather ?not-so-trivial ?? Programme, which deals with '+', '-' and '*' operations on E-J Prime Int Pairs.


Then, there are many Helper Functions ? pl refer the ReadMe doc.
My own Detailed Notes are in : E-J_Prm_Int_1.doc


Q : In which domain(s) are Eisenstein-Jacobi Prime Integer Pairs (E-J Prime Int Pairs for brevity) used ? ie, which branch of Engineering, or Physics, or Maths, makes maximum use of E-J Prime Int Pairs ?

Does the knowledge of E-J Ints help us in proving any important theorems in Maths ? Which are those ?

I assume that these would also find use in Cryptography too ? as do many applications relating to prime numbers ? Pl confirm.


Author's Legal Disclaimer :
This programme is being shared with others in good faith.
Everyone is free to use this code at his or her own risk provided they include my name for this part in their works.
However, I am still learning many facets of this subject ; there may be still some open unanswered technical questions for me on this subject and possibly in this programme.
I am NOT responsible for any technical or legal complications directly or indirectly, arising out of any direct or indirect use of this code.

From time to time, I may be updating / correcting the codes. From the experience of past submissions, I have observed that at times, a flurry of corrections often come to my mind in the days or few weeks immediately following the first submission. So, pl do look out for such possible updates / corrections.

Cite As

Sundar Krishnan (2024). Eisenstein-Jacobi Prime Integer Pair - Finding 'a' and 'b' (https://www.mathworks.com/matlabcentral/fileexchange/7759-eisenstein-jacobi-prime-integer-pair-finding-a-and-b), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Discrete Math in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes