cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A338756 Number of consecutive triples of quadratic residues mod p in the interval [1..p-1] where p is the n-th prime.

This page as a plain text file.
%I A338756 #20 Jan 27 2025 11:34:47
%S A338756 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,
%T A338756 16,18,17,16,18,16,20,20,24,22,24,23,24,24,24,26,27,28,24,24,29,32,31,
%U A338756 30,32,36,33,36,32,35,40,38,38,34,36,41,38,43,44,38,44,45,44,47
%N A338756 Number of consecutive triples of quadratic residues mod p in the interval [1..p-1] where p is the n-th prime.
%C A338756 Number of consecutive triples in A063987.
%H A338756 George E. Andrews, <a href="https://archive.org/details/NumberTheory_862/page/n141/mode/2up">Consecutive triples of quadratic residues</a>, paragraph 10-2, p. 133, in Number Theory, W.B. Saunders Company 1971.
%F A338756 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.
%e A338756 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.
%p A338756 a:= n-> (l-> add(`if`(l[i]-l[i-1]=1 and l[i+1]-l[i]=1 , 1, 0),
%p A338756          i=2..nops(l)-1))((p-> select(j-> numtheory[legendre]
%p A338756          (j, p)=1, [$1..p-1]))(ithprime(n))):
%p A338756 seq(a(n), n=1..80);  # _Alois P. Heinz_, Nov 08 2020
%t A338756 a[n_] := With[{p = Prime[n], KS = KroneckerSymbol},
%t A338756    Sum[(1+KS[k, p])*(1+KS[k+1, p])*(1+KS[k+2, p])/8, {k, 1, p-3}]];
%t A338756 Table[a[n], {n, 1, 75}] (* _Jean-François Alcover_, Jan 27 2025 *)
%o A338756 (PARI) C(k, p) = (1+kronecker(k,p))*(1+kronecker(k+1,p))*(1+kronecker(k+2,p))/8;
%o A338756 a(n) = my(p=prime(n)); sum(k=1, p-3, C(k,p));
%o A338756 (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}
%o A338756 vector(66,n,a(n)) \\ _Joerg Arndt_, Nov 08 2020
%Y A338756 Cf. A000040, A063987.
%K A338756 nonn
%O A338756 1,8
%A A338756 _Michel Marcus_, Nov 07 2020