login
A277777
Largest nontrivial square root of unity modulo the n-th positive integer that does not have a primitive root (A033949).
3
5, 7, 11, 9, 11, 13, 19, 15, 19, 17, 23, 29, 19, 25, 31, 29, 23, 26, 41, 35, 27, 34, 43, 37, 49, 55, 33, 51, 43, 35, 47, 41, 55, 49, 39, 43, 53, 71, 71, 69, 59, 67, 71, 64, 47, 61, 56, 79, 89, 51, 67, 79, 76, 55, 89, 73, 97, 77, 91, 59, 64, 69, 109, 83, 63, 71
OFFSET
1,1
FORMULA
a(n) = A033949(n) - A082568(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
A277777_list = list(islice(A277777_gen(), 30)) # Chai Wah Wu, Oct 26 2022
CROSSREFS
Last elements of nonempty rows of A277776.
Sequence in context: A096919 A023594 A357099 * A254930 A317769 A104200
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Oct 30 2016
STATUS
approved