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. The2^1024 - 2^960produces a number where the first 64 bits are1s. Multiplying the⌊2^894 * π + 129093⌋by2^64and subtracting1produces a number where the last 64 bits are1s. 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 by2^894to extract896bits(1024-64-64)bits of pi. The+ 129093is just an offset to make the overall result prime.