OFFSET
1,1
COMMENTS
By definition of the map defined in A076340, A076341: 2->(2,0) and p->((floor(p/4)+floor((p mod 4)/2))*4,2-(p mod 4)) for odd primes p.
Number of solutions to x^2 + y^2 = 1 (mod p). - Lekraj Beedassy, Oct 22 2004
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = p-(-1/p) = p+(-1)^{(p+1)/2} for an odd prime p. {(a/b) stands for the value of the Legendre symbol}. - Lekraj Beedassy, Oct 22 2004
From Amiram Eldar, Dec 24 2022: (Start)
Product_{n>=1} a(n)/prime(n) = 4/Pi (A088538). (End)
MAPLE
f:= proc(n) local p;
p:= ithprime(n);
if p mod 4 = 1 then p-1 elif p mod 4 = 3 then p+1 else 2 fi
end proc:
map(f, [$1..100]); # Robert Israel, Dec 26 2016
MATHEMATICA
a[1] = 2; a[n_] := With[{p = Prime[n]}, p - JacobiSymbol[-1, p]]; Array[a, 60] (* Jean-François Alcover, Feb 01 2018, after Lekraj Beedassy *)
a[n_] := Prime[n] - 2 + Mod[Prime[n], 4]; Array[a, 100] (* Amiram Eldar, Dec 24 2022 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Oct 08 2002
STATUS
approved