The function for Oakley group 2, p = 2^1024 - 2^960 - 1 + 2^64 * ⌊2^894 * π + 129093⌋, produces a prime number. It contains pi, an irrational number. How can an equation containing an irrational number produce a rational product?
I looked on the internet and could not find an answer. I learned in my mathematical structures class that the product of a rational and irrational number is irrational so this makes me wonder how pi is used to produce a prime.
Rossum already answered your question in the comments, but I'm going to elaborate a bit more on the structure of this prime.
As Rossum says, the ⌊⌋
in the ⌊2^894 * π + 129093⌋
portion denote the mathematical floor function, yielding the largest integer less than or equal to the argument. The 2^1024 - 2^960
produces a number where the first 64 bits are 1
s. Multiplying the ⌊2^894 * π + 129093⌋
by 2^64
and subtracting 1
produces a number where the last 64 bits are 1
s. Combining these, we have a number where the first and last 64 bits are ones, since there will be no carrying in the addition of the two.
Within the ⌊2^894 * π + 129093⌋
, pi is multiplied by 2^894
to extract 896
bits (1024-64-64)
bits of pi. The + 129093
is just an offset to make the overall result prime.