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, 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
Keywords
Examples
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.
Links
- George E. Andrews, Consecutive triples of quadratic residues, paragraph 10-2, p. 133, in Number Theory, W.B. Saunders Company 1971.
Programs
-
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
-
Mathematica
a[n_] := With[{p = Prime[n], KS = KroneckerSymbol}, Sum[(1+KS[k, p])*(1+KS[k+1, p])*(1+KS[k+2, p])/8, {k, 1, p-3}]]; Table[a[n], {n, 1, 75}] (* Jean-François Alcover, Jan 27 2025 *)
-
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
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.
Comments