OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
Wikipedia, Root of unity modulo n
PROG
(Python)
from gmpy2 import *
def f(n):
for k in range(n - 2, 0, -1):
if pow(k, 2, n) == 1:
return k
def A277777(L):
return [j for j in [f(k) for k in range(3, L + 1)] if j > 1] # Darío Clavijo, Oct 15 2022
(Python)
from itertools import count, islice
from sympy.ntheory import sqrt_mod_iter
def A277777_gen(): # generator of terms
for n in count(3):
if (m:=max(filter(lambda k:k<n-1, sqrt_mod_iter(1, n)))) > 1:
yield m
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Oct 30 2016
STATUS
approved