OFFSET
2,2
COMMENTS
Let p and q be distinct odd primes. Then there exists an integer i such that 2^i == -1 (mod p*q) if and only if a(u) = a(v) and a(u), a(v) > 0, where u and v are the indices of p and q in A000040, respectively (cf. Anderson, Preece, 2008, Lemma 1.4).
LINKS
I. Anderson and D. A. Preece, A general approach to constructing power-sequence terraces for Z_n, Discrete Mathematics, Vol. 308, No. 5-6 (2008), 631-644.
EXAMPLE
For n = 7: A014664(7) = 8 and the 2-adic valuation of 8 is 3, since 2^3 = 8, so a(7) = 3.
PROG
(PARI) a(n) = valuation(znorder(Mod(2, prime(n))), 2);
(Python)
from sympy import n_order, prime
def A309816(n): return (~(m:=n_order(2, prime(n))) & m-1).bit_length() # Chai Wah Wu, Nov 10 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Felix Fröhlich, Aug 18 2019
STATUS
approved