# Wall–Sun–Sun prime

In number theory, a Wall–Sun–Sun prime or Fibonacci–Wieferich prime is a certain kind of prime number which is conjectured to exist, although none are known.

## Definition

Let $p$ be a prime number. When each term in the sequence of Fibonacci numbers $F_{n}$ is reduced modulo $p$, the result is a periodic sequence. The (minimal) period length of this sequence is called the Pisano period and denoted $\pi (p)$. Since $F_{0}=0$, it follows that p divides $F_{\pi (p)}$. A prime p such that p$^2$ divides $F_{\pi (p)}$ is called a Wall–Sun–Sun prime.

### Equivalent definitions

If $\alpha (m)$ denotes the rank of apparition modulo $m$ (i.e., $\alpha (m)$ is the smallest positive index such that $m$ divides $F_{\alpha (m)}$), then a Wall–Sun–Sun prime can be equivalently defined as a prime $p$ such that $p^{2}$ divides $F_{\alpha (p)}$.
For a prime p ≠ 2, 5, the rank of apparition $\alpha (p)$ is known to divide $p-\left({\tfrac {p}{5}}\right)$, where the Legendre symbol $\textstyle \left({\frac {p}{5}}\right)$ has the values
    $\left({\frac {p}{5}}\right)={\begin{cases}1&{\text{if }}p\equiv \pm 1{\pmod {5}};\\-1&{\text{if }}p\equiv \pm 2{\pmod {5}}.\end{cases}}$
This observation gives rise to an equivalent characterization of Wall–Sun–Sun primes as primes $p$ such that $p^{2}$ divides the Fibonacci number $F_{p-\left({\frac {p}{5}}\right)}$.
A prime $p$ is a Wall–Sun–Sun prime if and only if $\pi (p^{2})=\pi (p)$.
A prime $p$ is a Wall–Sun–Sun prime if and only if $L_{p}\equiv 1{\pmod {p^{2}}}$, where $L_{p}$ is the $p$-th Lucas number.$^{:42}$
McIntosh and Roettger establish several equivalent characterizations of Lucas–Wieferich primes. In particular, let $\epsilon =\left({\tfrac {p}{5}}\right)$; then the following are equivalent:
* $F_{p-\epsilon }\equiv 0{\pmod {p^{2}}}$
* $L_{p-\epsilon }\equiv 2\epsilon {\pmod {p^{4}}}$
* $L_{p-\epsilon }\equiv 2\epsilon {\pmod {p^{3}}}$
* $F_{p}\equiv \epsilon {\pmod {p^{2}}}$
* $L_{p}\equiv 1{\pmod {p^{2}}}$

## Existence

In a study of the Pisano period $k(p)$, Donald Dines Wall determined that there are no Wall–Sun–Sun primes less than $10000$. In 1960, he wrote:
   The most perplexing problem we have met in this study concerns the hypothesis $k(p^{2})\neq k(p)$. We have run a test on digital computer which shows that $k(p^{2})\neq k(p)$ for all $p$ up to $10000$; however, we cannot prove that $k(p^{2})=k(p)$ is impossible. The question is closely related to another one, "can a number $x$ have the same order mod $p$ and mod $p^{2}$?", for which rare cases give an affirmative answer (e.g., $x=3,p=11$; $x=2,p=1093$); hence, one might conjecture that equality may hold for some exceptional $p$.
It has since been conjectured that there are infinitely many Wall–Sun–Sun primes.
In 2007, Richard J. McIntosh and Eric L. Roettger showed that if any exist, they must be > 2×10$^{14}$. Dorais and Klyve extended this range to 9.7×10$^{14}$ without finding such a prime.
In December 2011, another search was started by the PrimeGrid project; however, it was suspended in May 2017. In November 2020, PrimeGrid started another project that searches for Wieferich and Wall–Sun–Sun primes simultaneously. The project ended in December 2022, definitely proving that any Wall–Sun–Sun prime must exceed $2^{64}$ (about $18\cdot 10^{18}$).

## History

Wall–Sun–Sun primes are named after Donald Dines Wall, Zhi Hong Sun and Zhi Wei Sun; Z. H. Sun and Z. W. Sun showed in 1992 that if the first case of Fermat's Last Theorem was false for a certain prime p, then p would have to be a Wall–Sun–Sun prime. As a result, prior to Andrew Wiles' proof of Fermat's Last Theorem, the search for Wall–Sun–Sun primes was also the search for a potential counterexample to this centuries-old conjecture.

## Generalizations

A tribonacci–Wieferich prime is a prime p satisfying h(p) = h(p$^2$), where h is the least positive integer satisfying [T$_h$,T$_{h+1}$,T$_{h+2}$] ≡ [T$_0$, T$_1$, T$_2$] (mod m) and T$_n$ denotes the n-th tribonacci number. No tribonacci–Wieferich prime exists below 10$^{11}$.
A Pell–Wieferich prime is a prime p satisfying p$^2$ divides P$_{p−1}$, when p congruent to 1 or 7 (mod 8), or p$^2$ divides P$_{p+1}$, when p congruent to 3 or 5 (mod 8), where P$_n$ denotes the n-th Pell number. For example, 13, 31, and 1546463 are Pell–Wieferich primes, and no others below 10$^9$ (sequence A238736 in the OEIS). In fact, Pell–Wieferich primes are 2-Wall–Sun–Sun primes.

### Near-Wall–Sun–Sun primes

A prime p such that $F_{p-\left({\frac {p}{5}}\right)}\equiv Ap{\pmod {p^{2}}}$ with small |A| is called near-Wall–Sun–Sun prime. Near-Wall–Sun–Sun primes with A = 0 would be Wall–Sun–Sun primes. PrimeGrid recorded cases with |A| ≤ 1000. A dozen cases are known where A = ±1 (sequence A347565 in the OEIS).

### Wall–Sun–Sun primes with discriminant D

Wall–Sun–Sun primes can be considered for the field $Q_{\sqrt {D}}$ with discriminant D. For the conventional Wall–Sun–Sun primes, D = 5. In the general case, a Lucas–Wieferich prime p associated with (P, Q) is a Wieferich prime to base Q and a Wall–Sun–Sun prime with discriminant D = P$^2$ – 4Q. In this definition, the prime p should be odd and not divide D.
It is conjectured that for every natural number D, there are infinitely many Wall–Sun–Sun primes with discriminant D.
The case of $(P,Q)=(k,-1)$ corresponds to the k-Wall–Sun–Sun primes, for which Wall–Sun–Sun primes represent the special case k = 1. The k-Wall–Sun–Sun primes can be explicitly defined as primes p such that p$^2$ divides the k-Fibonacci number $F_{k}(\pi _{k}(p))$, where F$_k$(n) = U$_n$(k, −1) is a Lucas sequence of the first kind with discriminant D = k$^2$ + 4 and $\pi _{k}(p)$ is the Pisano period of k-Fibonacci numbers modulo p. For a prime p ≠ 2 and not dividing D, this condition is equivalent to either of the following.
* p$^2$ divides $F_{k}\left(p-\left({\tfrac {D}{p}}\right)\right)$, where $\left({\tfrac {D}{p}}\right)$ is the Kronecker symbol;
* V$_p$(k, −1) ≡ k (mod p$^2$), where V$_n$(k, −1) is a Lucas sequence of the second kind.
The smallest k-Wall–Sun–Sun primes for k = 2, 3, ... are
    13, 241, 2, 3, 191, 5, 2, 3, 2683, ... (sequence A271782 in the OEIS)