OFFSET
1,8
COMMENTS
Number of consecutive triples in A063987.
LINKS
George E. Andrews, Consecutive triples of quadratic residues, paragraph 10-2, p. 133, in Number Theory, W.B. Saunders Company 1971.
FORMULA
a(n) = Sum_{k=1, p-3} (1+(k/p))*(1+((k+1)/p))*(1+((k+2)/p))/8 where (x/y) is the Kronecker symbol and p is the n-th prime. See Andrews pp. 133-134.
EXAMPLE
The 8th row of A063987 for prime 19 is [1, 4, 5, 6, 7, 9, 11, 16, 17] has 2 consecutive triples [4, 5, 6] and [5, 6, 7], so a(8)=2.
MAPLE
a:= n-> (l-> add(`if`(l[i]-l[i-1]=1 and l[i+1]-l[i]=1 , 1, 0),
i=2..nops(l)-1))((p-> select(j-> numtheory[legendre]
(j, p)=1, [$1..p-1]))(ithprime(n))):
seq(a(n), n=1..80); # Alois P. Heinz, Nov 08 2020
PROG
(PARI) C(k, p) = (1+kronecker(k, p))*(1+kronecker(k+1, p))*(1+kronecker(k+2, p))/8;
a(n) = my(p=prime(n)); sum(k=1, p-3, C(k, p));
(PARI) a(n)={my(p=prime(n), v=vector(p-1, n, issquare(Mod(n, p))), ct=0); for(j=1, #v-2, ct+=(v[j]&&v[j+1]&&v[j+2])); ct}
vector(66, n, a(n)) \\ Joerg Arndt, Nov 08 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Marcus, Nov 07 2020
STATUS
approved