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.

A059771 Second solution of x^2 = 2 mod p for primes p such that a solution exists.

This page as a plain text file.
%I A059771 #9 Sep 07 2023 16:00:10
%S A059771 0,4,11,18,23,24,40,59,41,70,64,83,65,62,111,106,105,154,134,141,179,
%T A059771 208,148,140,219,197,153,175,149,245,193,311,186,340,288,246,348,312,
%U A059771 243,227,418,419,377,260,292,396,346,272,368,543,451,433,379,413,321
%N A059771 Second solution of x^2 = 2 mod p for primes p such that a solution exists.
%C A059771 Solutions mod p are represented by integers from 0 to p-1. For p > 2: If x^2 = 2 has a solution mod p, then it has exactly two solutions and their sum is p; i is a solution mod p of x^2 = 2 iff p-i is a solution mod p of x^2 = 2. No integer occurs more than once in this sequence. Moreover, no integer (except 0) occurs both in this sequence and in sequence A059770 of the first solutions (Cf. A059772).
%H A059771 Robert Israel, <a href="/A059771/b059771.txt">Table of n, a(n) for n = 1..10000</a>
%F A059771 a(n) = second (larger) solution of x^2 = 2 mod p, where p is the n-th prime such that x^2 = 2 mod p has a solution, i.e. p is the n-th term of A038873. a(n) = 0 if x^2 = 2 mod p has one solution (only for p = 2).
%e A059771 a(6) = 24 since 41 is the sixth term of A038873, 17 and 24 are the solutions mod 41 of x^2 = 2 and 24 is the larger one.
%p A059771 R:= 0: p:= 2: count:= 1:
%p A059771 while count < 100 do
%p A059771   p:= nextprime(p);
%p A059771   if NumberTheory:-QuadraticResidue(2,p)=1 then
%p A059771     v:= NumberTheory:-ModularSquareRoot(2,p);
%p A059771     R:= R, max(v,p-v);
%p A059771     count:= count+1
%p A059771   fi
%p A059771 od:
%p A059771 R; # _Robert Israel_, Sep 07 2023
%Y A059771 Cf. A038873, A059770, A059772.
%K A059771 nonn,look
%O A059771 1,2
%A A059771 _Klaus Brockhaus_, Feb 21 2001