OFFSET
1,5
COMMENTS
Wraparound progressions as well as decreasing progressions are counted.
REFERENCES
R. Crandall and C. Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see Exercise 2.29 p. 111.
FORMULA
a(n) = (prime(n)-1)*floor((prime(n)-2)/8).
EXAMPLE
For p=prime(5)=11, whose quadratic residues are (1,3,4,5,9), some examples of 3-term arithmetic progressions are (3,4,5), (4,9,3) and (5,4,3).
MATHEMATICA
Table[(# - 1) Floor[(# - 2)/8] &@ Prime@ n, {n, 51}] (* Michael De Vlieger, Mar 23 2016 *)
PROG
(PARI) a(n) = my(p=prime(n)); (p-1)*((p-2)\8);
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Marcus, Mar 23 2016
STATUS
approved