login
A338756
Number of consecutive triples of quadratic residues mod p in the interval [1..p-1] where p is the n-th prime.
0
0, 0, 0, 0, 1, 0, 0, 2, 2, 4, 3, 4, 2, 5, 5, 4, 7, 8, 8, 8, 8, 9, 10, 8, 8, 12, 12, 13, 12, 14, 15, 16, 18, 17, 16, 18, 16, 20, 20, 24, 22, 24, 23, 24, 24, 24, 26, 27, 28, 24, 24, 29, 32, 31, 30, 32, 36, 33, 36, 32, 35, 40, 38, 38, 34, 36, 41, 38, 43, 44, 38, 44, 45, 44, 47
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
Sequence in context: A368149 A051297 A371409 * A078317 A105016 A074747
KEYWORD
nonn
AUTHOR
Michel Marcus, Nov 07 2020
STATUS
approved