%I #15 Mar 31 2021 20:22:13
%S 139,151,331,619,811,1231,1279,1291,1471,1579,1699,1999,2239,2251,
%T 2371,2659,3271,3331,3391,3499,3631,3919,4051,4159,4231,4759,5059,
%U 5839,6079,6619,6691,6991,7219,7639,8059,8599,8731,8971,9151,9319,9679,9739,10099,10459,10771
%N Primes p such that A001177(p) = (p-1)/3.
%C Primes p such that ord(-(3+sqrt(5))/2,p) = (p-1)/3, where ord(z,p) is the smallest integer k > 0 such that (z^k-1)/p is an algebraic integer.
%C Let {T(n)} be a sequence defined by T(0) = 0, T(1) = 1, T(n) = k*T(n-1) + T(n-2), K be the quadratic field Q[sqrt(k^2+4)], O_K be the ring of integer of K, u = (k+sqrt(k^2+4))/2. For a prime p not dividing k^2 + 4, the Pisano period of {T(n)} modulo p (that is, the smallest m > 0 such that T(n+m) == T(n) (mod p) for all n) is ord(u,p); the entry point of {T(n)} modulo p (that is, the smallest m > 0 such that T(m) == 0 (mod p)) is ord(-u^2,p).
%C For an odd prime p:
%C (a) if p decomposes in K, then (O_K/pO_K)* (the multiplicative group of O_K modulo p) is congruent to C_(p-1) X C_(p-1), so the entry point of {T(n)} modulo p is equal to (p-1)/s, s = 1, 2, 3, 4, ...;
%C (b) if p is inert in K, then u^(p+1) == -1 (mod p), (-u^2)^(p+1) == 1 (mod p), so the entry point of {T(n)} modulo p is equal to (p+1)/s, s = 1, 2, 3, 4, ...
%C Here k = 1, and this sequence gives primes such that (a) holds and s = 3. For odd s, all terms are congruent to 3 modulo 4.
%C Number of terms below 10^N:
%C N | Number | Decomposing primes*
%C 3 | 5 | 78
%C 4 | 42 | 609
%C 5 | 312 | 4777
%C 6 | 2490 | 39210
%C 7 | 20958 | 332136
%C 8 | 181493 | 2880484
%C * Here "Decomposing primes" means primes such that Legendre(5,p) = 1, i.e., p == 1, 4 (mod 5).
%H Bob Bastasz, <a href="https://www.fq.math.ca/Papers1/58-5/bastasz.pdf">Lyndon words of a second-order recurrence</a>, Fibonacci Quarterly (2020) Vol. 58, No. 5, 25-29.
%t pn[n_] := For[k = 1, True, k++, If[Mod[Fibonacci[k], n] == 0, Return[k]]];
%t Reap[For[p = 2, p < 10000, p = NextPrime[p], If[Mod[p, 3] == 1, If[pn[p] == (p - 1)/3, Print[p]; Sow[p]]]]][[2, 1]] (* _Jean-François Alcover_, Jul 05 2019 *)
%o (PARI) Entry_for_decomposing_prime(p) = my(k=1, M=[k, 1; 1, 0]); if(isprime(p)&&kronecker(k^2+4,p)==1, my(v=divisors(p-1)); for(d=1, #v, if((Mod(M,p)^v[d])[2,1]==0, return(v[d]))))
%o forprime(p=2, 11000, if(Entry_for_decomposing_prime(p)==(p-1)/3, print1(p, ", ")))
%Y Similar sequences that give primes such that (a) holds: A106535 (s=1), A308795 (s=2), this sequence (s=3), A308797 (s=4), A308798 (s=5), A308799 (s=6), A308800 (s=7), A308801 (s=8), A308802 (s=9).
%K nonn
%O 1,1
%A _Jianing Song_, Jun 25 2019