(49 50) Primitive Roots Modulo n - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (49 50) Primitive Roots Modulo n (/thread-22782.html) |
(49 50) Primitive Roots Modulo n - John Keith - 11-28-2024 12:44 PM Two programs regarding primitive roots. The programs require the libraries ListExt and IFACTOR, and Gerald H's ORD (multiplicative order, see also this post). The first program 'NOPR' returns the number of primitive roots modulo n. Code:
The second program 'LOPR' returns a list of all primitive roots modulo n. If n has no primitive roots, the list will be empty, otherwise the size of the list will be Phi(Phi(n)). Equivalent to the Wolfram language (Mathematica) function PrimitiveRootList. Execution time is roughly proportional to n. Code:
|