For a prime number $p$ and a natural numbers $a$ not divisible by $p$, let $i(p,a)$ be the smallest of the natural number $i$ such that $$a^i\equiv 1\mod p.$$ We know from Fermat's little theorem that $i(p,a)|(p-1)$ How to determine the function $i(p,a)$?
Asked
Active
Viewed 128 times
1
-
$i\mid (p-1)$ is known. – Roddy MacPhee Sep 11 '21 at 19:10
-
@SaucyO'Path: $0$ is NOT a natural number. Natural numbers start from $1$. Also $i$ depends on $p$ and $a$. I have edited the question to make it clearer. – Hans Sep 11 '21 at 19:15
-
3@Hans Ok, ok, have fun both with the Dark Centuries of $0\notin \Bbb N$, and with your brand new question. – Sep 11 '21 at 19:18
-
$i(p, a)$ is called the order of $a$ mod $p$. See this wiki page. It then depends on what you mean by "determine the function". There are known algorithms that can compute the order. – WhatsUp Sep 11 '21 at 19:19
-
@Hans There is also no reason to think it is not in $\mathbb{N}$ as much as there is for it being in $\mathbb{N}$. Just like the way we say that a multiplicative inverse in a field cannot be equal to the additive identity, it has no sake other than convenience rather than logical necessity (en fact there are systems that accommodate it with normal arithmetic that we're used to [if you don't dig deep enough, meaning it works for normal needs]) . I don't get the strong reason for excluding it, and I think it is more natural (no pun intended) to include it. – Sep 12 '21 at 15:42
-
@Math3147: Are you referring to $0\notin \mathbb N$? I totally agree it is only a convention if that is what you are saying. However, some conventions like this one do provide some convenience. Specifically in this case, it excludes the trivial case of $i(p,a)=0$. – Hans Sep 12 '21 at 22:41
-
@Hans I'm referring to your statement of "(...) $0$ is NOT a natural number". I'm saying, there is no reason (a logical reason) to say that you're correct in saying that. In my opinion, the arguments around it are blown out of proportion but it is largely a matter of convenience rather than a matter of fact like you seemed to state it. I understand the convenience here but your statement before it seems unvalid to me if it was supposed to be matter-of-fact or de facto. (Due to reasons stated in my previous comment.) – Sep 13 '21 at 00:23
-
If you strictly meant to say that to refer to convention, then please do state so, because, taken at face value... this seems like a statement of fact rather than a point of convention (which I agree on, that it should be the convention in fields like number theory due to the matter of convenience, like $1$ being excluded from the Fundamental Theorem of Arithmetic, and other implicit convenience matters, they should be the norm to shift aside negligible things). – Sep 13 '21 at 00:26
-
@Math3147: I do not think it is worth arguing about a convention rising out of convenience. The convenience has it merit. Can you also read about the exclusion of trivial case I mentioned in my last comment? – Hans Sep 13 '21 at 02:42
2 Answers
1
In general there isnt a clean form for this.All we know is that $i(p,a)\mid p-1$.Although you can find $i(p,a)$ in $O(\log(p))$ time.Check this Is there a better way of finding the order of a number modulo $n$? once

Pluto_1708
- 26
-
1Wrong. We know that $i(a,p)$ and $i(-a,p)$ are either the same (if $-1$ shows up in an even exponent for one), or double/half ($-1$ showing up in an odd exponent for one). We also know $i(a,p)$ and $i(a^{-1},p)$ are the same. – Roddy MacPhee Sep 11 '21 at 20:02
-
1In fact we even know $a^{x}$ will just skip through $a$'s Pattern by $x$ so unless $a$'s order is coprime with $x$ it'll have an order related to it's actual GCD. – Roddy MacPhee Sep 12 '21 at 01:12
-
@RoddyMacPhee: Would you please be so kind as to elaborate the details on all your points, best in an answer? I would really appreciate it. – Hans Sep 12 '21 at 13:48
1
While it can be hard to determine the exact values, we know quite a bit:
- $i(a,p)$ and $i(-a,p)$ are related because $(-1)^{2n}=1$ and $(-1)^{2n+1}=-1$ so odd exponents lead the powers to be additive inverses ( meaning $-1$ for one will map to $1$ for the other if it occurs), and even exponents lead to the same remainder class ( meaning $-1$ is in the same place for both if it occurs). This plus $(-1)^2=1$ is enough to show that they either by have same order, or a factor of two difference.
- $i(a,p)$ and $i(a^{-1},p)$ are the same, because each factor of $a$ cancels a factor of $a^{-1}$ so they are multiplicative inverses for any exponent . It just so happens that $1^{-1}=1$ .
- $i(a^x,p)$ is related to to $i(a,p)$ because $(a^x)(a^x)=a^{x+x}$ so $x$'s "additive order" modulo $i(a,p)$ is $i(a^x,p)$
- we also get $i(a,p)\mid p-1$ by Fermat's little theorem and $1^n=1$ .
Here's an example of getting the orders of all non trivial remainder classes (we know $1^1\equiv (-1)^2\equiv 1$):
- $2^7\equiv 1\pmod {127}$ since $7$ is prime ( therefore coprime to other exponents $7\nmid x$) , this implies the orders of all powers of $2$ is $7$ , as it can't be halved, for additive inverses of powers of $2$ it must double to $14$.( So we've dealt with $2,4,8,16,32,63,64,95,111,119,123,125$ all with just 3 facts.
- $3^{126}\equiv 1\pmod {127}$ ( aka $3$ is a primitive root, so every remainder class is congruent a power) $9$ and it's multiplicative inverse have order $63$ (while $9$'s additive inverse has order $126$ ), $27$ and it's multiplicative inverse have order $42$( while a bit of calculation will show you it's additive inverse has order $21$), ... Anyways you can use the powers of $3$ to basically calculate their orders.

Roddy MacPhee
- 859
-
Thank you. I did not explain well, these properties seem easy. I am more interested in your statement "unless $$'s order is coprime with $$ it'll have an order related to its actual GCD." Could you elaborate that? – Hans Sep 12 '21 at 22:03
-
Second to last point, and period of addition under gcd ... None are hard. Just points the previous answer lacked. – Roddy MacPhee Sep 12 '21 at 22:13
-
-
-