OFFSET
1,1
COMMENTS
The sequence comprises the positive powers of 2, the positive powers of primes congruent to 1 mod 4, and the positive even powers of primes congruent to 3 mod 4.
The multiplication group of GF(p^n) is cyclic of order o = p^n-1. For p=2, 1=-1, so 1 is a square root of -1. Otherwise, -1 has order 2 and so any square root of -1 has order 4. So, for there to be a square root of -1, o mod 4 must be 0, i.e. p^n mod 4 = 1. Then if g is a generator of the group, g^(o/4) is a square root of -1. p^n mod 4 = 1 if and only if p mod 4 = 1 or p mod 4 = 3 and n is even.
PROG
(Python)
from itertools import count
from msmath.numfuns import primepower
def a(start=2, stop=None) :
for n in range(start, stop) if stop else count(start):
if primepower(n) :
if n%4 != 3: yield n
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Mike Speciner, May 17 2024
STATUS
approved