OFFSET
1,1
COMMENTS
A002145 are precisely the rational primes in the ring of Gaussian integers.
From the representation of complex numbers as 2 X 2 matrices, a(n) is also the multiplicative order of the matrix [2,-1;1,2] or [2,1;-1,2] modulo p.
a(n) is divisible by ord(5,p): If (2+-i)^n == 1 (mod p), then 5^n == 1 (mod p).
a(n) divides (p+1) * ord(5,p), since we have (2+-i)^(p+1) == 5 (mod p).
If 5 is a quadratic residue modulo p, then ord(5,p) divides (p-1)/2, and so a(n) divides (p^2-1)/2. Conversely, if a(n) divides (p^2-1)/2, then (x+-y*i)^2 == 2+-i (mod p) for some integers x, y, and so (x^2+y^2)^2 == 5 (mod p), which means that 5 is a quadratic residue modulo p.
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
EXAMPLE
The multiplicative order of 2+-i modulo A002145(3) = 11 is a(3) = 30, since (2+-i)^30 == 1 (mod 11), and 30 is the smallest such exponent.
PROG
(PARI) ord(p) = my(d = divisors((p+1)*znorder(Mod(5, p)))); for(i=1, #d, if(Mod([2, -1; 1, 2], p)^d[i] == 1, return(d[i]))) \\ for a prime p == 3 (mod 4), returns ord(2+-i, p)
forprime(p=3, 1e3, if(p%4==3, print1(ord(p), ", ")))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jianing Song, Jun 20 2025
STATUS
approved
