%I #26 Oct 26 2022 13:12:24
%S 5,7,11,9,11,13,19,15,19,17,23,29,19,25,31,29,23,26,41,35,27,34,43,37,
%T 49,55,33,51,43,35,47,41,55,49,39,43,53,71,71,69,59,67,71,64,47,61,56,
%U 79,89,51,67,79,76,55,89,73,97,77,91,59,64,69,109,83,63,71
%N Largest nontrivial square root of unity modulo the n-th positive integer that does not have a primitive root (A033949).
%H Alois P. Heinz, <a href="/A277777/b277777.txt">Table of n, a(n) for n = 1..10000</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Root_of_unity_modulo_n">Root of unity modulo n</a>
%F a(n) = A033949(n) - A082568(n).
%o (Python)
%o from gmpy2 import *
%o def f(n):
%o for k in range(n - 2, 0, -1):
%o if pow(k, 2, n) == 1:
%o return k
%o def A277777(L):
%o return [j for j in [f(k) for k in range(3, L + 1)] if j > 1] # _DarĂo Clavijo_, Oct 15 2022
%o (Python)
%o from itertools import count, islice
%o from sympy.ntheory import sqrt_mod_iter
%o def A277777_gen(): # generator of terms
%o for n in count(3):
%o if (m:=max(filter(lambda k:k<n-1,sqrt_mod_iter(1,n)))) > 1:
%o yield m
%o A277777_list = list(islice(A277777_gen(),30)) # _Chai Wah Wu_, Oct 26 2022
%Y Last elements of nonempty rows of A277776.
%Y Cf. A033948, A033949, A082568.
%K nonn,look
%O 1,1
%A _Alois P. Heinz_, Oct 30 2016
|