A111945 Duplicate of A002143.
1, 1, 1, 3, 3, 1, 5, 3, 1, 7, 5, 3, 5
Offset: 1
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.
a002145 n = a002145_list !! (n-1) a002145_list = filter ((== 1) . a010051) [3, 7 ..] -- Reinhard Zumkeller, Aug 02 2015, Sep 23 2011
[4*n+3 : n in [0..142] | IsPrime(4*n+3)]; // Arkadiusz Wesolowski, Nov 15 2013
A002145 := proc(n) option remember; if n = 1 then 3; else a := nextprime(procname(n-1)) ; while a mod 4 <> 3 do a := nextprime(a) ; end do; return a; end if; end proc: seq(A002145(n),n=1..20) ; # R. J. Mathar, Dec 08 2011
Select[4Range[150] - 1, PrimeQ] (* Alonso del Arte, Dec 19 2013 *) Select[ Prime@ Range[2, 110], Length@ PowersRepresentations[#^2, 2, 2] == 1 &] (* or *) Select[ Prime@ Range[2, 110], JacobiSymbol[-1, #] == -1 &] (* Robert G. Wilson v, May 11 2014 *)
forprime(p=2,1e3,if(p%4==3,print1(p", "))) \\ Charles R Greathouse IV, Jun 10 2011
def A002145_list(n): return [p for p in prime_range(1, n + 1) if p % 4 == 3] # Peter Luschny, Jul 29 2014
If n = 3, then p = 5 and a(3) = 1 + 4 = 5. If n = 4, then p = 7 and a(4) = 1 + 4 + 2 = 7. If n = 5, then p = 11 and a(5) = 1 + 4 + 9 + 5 + 3 = 22. - _Michael Somos_, Jul 01 2018
A076409 := proc(n) local a,p,i ; p := ithprime(n) ; a := 0 ; for i from 1 to p-1 do if numtheory[legendre](i,p) = 1 then a := a+i ; end if; end do; a ; end proc: # R. J. Mathar, Feb 26 2011
Join[{1,1}, Table[ Apply[ Plus, Flatten[ Position[ Table[ JacobiSymbol[i, Prime[n]], {i, 1, Prime[n] - 1}], 1]]], {n, 3, 48}]] Join[{1}, Table[p=Prime[n]; If[Mod[p,4]==1, p(p-1)/4, Sum[PowerMod[k,2, p],{k,p/2}]], {n,2,1000}]] (* Zak Seidov, Nov 02 2011 *) a[ n_] := If[ n < 3, Boole[n > 0], With[{p = Prime[n]}, Sum[ Mod[k^2, p], {k, (p - 1)/2}]]]; (* Michael Somos, Jul 01 2018 *)
a(n,p=prime(n))=if(p<5,return(1)); if(k%4==1, return(p\4*p)); sum(k=1,p-1,k^2%p) \\ Charles R Greathouse IV, Feb 21 2017
a=Table[0, {101}]; Do[If[PrimeQ[m], c=NumberFieldClassNumber[Sqrt[-m]]; If[c<102 && a[[c]]==0, a[[c]]=m]], {m, 3, 30000, 8}]; Table[a[[n]], {n, 1, 101, 2}]
a(n) = forprime(p=2, oo, if ((p % 8) == 7, if (qfbclassno(-p) == 2*n+1, return(p)))); \\ Michel Marcus, Jul 20 2022
Table[Sum[KroneckerSymbol[k, n]*k, {k, 0, n - 1}], {n, 0, 50}] (* G. C. Greubel, Apr 23 2018 *)
a(n) = sum(i=1,n-1, kronecker(i,n)*i)
The quadratic residues of 19, the 8th prime, are 1, 4, 5, 6, 7, 9, 11, 16, 17. Hence a(8)=6-3=3.
A178153 := proc(n) local r,a,p; p := ithprime(n) ; a := 0 ; for r from 1 to p/2 do if numtheory[legendre](r,p) =1 then a := a+1 ; end if; end do: for r from ceil(p/2) to p-1 do if numtheory[legendre](r,p) =1 then a := a-1 ; end if; end do: a; end proc: # R. J. Mathar, Feb 10 2017
Table[p=Prime[n]; Length[Select[Range[(p-1)/2], JacobiSymbol[ #,p]==1&]] - Length[Select[Range[(p+1)/2,p-1], JacobiSymbol[ #,p]==1&]], {n,2,100}] Table[p = Prime[n]; Sum[ JacobiSymbol[a, p], {a, 1, (p-1)/2}], {n, 2, 100}] (* Jonathan Sondow, Oct 30 2011 *)
f:= proc(n) local t; add(`if`(igcd(t,n)=1, t*numtheory:-quadres(t,n),0), t=1..n-1) end proc: map(f, [$1..100]); # Robert Israel, Feb 27 2025
{ A255643(n) = my(r); r=0; for(i=0,n-1, if(gcd(i,n)>1,next); if(issquare(Mod(i,n)), r+=i, r-=i) ); r }
{ A255643(n) = my(r); r=0; for(i=0,n-1, if(issquare(Mod(i,n)), r+=i, r-=i) ); r }
Comments