A165909 a(n) is the sum of the quadratic residues of n.
0, 1, 1, 1, 5, 8, 7, 5, 12, 25, 22, 14, 39, 42, 30, 14, 68, 60, 76, 35, 70, 110, 92, 42, 125, 169, 126, 84, 203, 150, 186, 72, 165, 289, 175, 96, 333, 342, 208, 135, 410, 308, 430, 198, 225, 460, 423, 124, 490, 525, 408, 299, 689, 549, 385, 252, 532, 841, 767, 270
Offset: 1
Keywords
References
- G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 4th ed., Oxford Univ. Press, 1960, pp. 88-90.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from C. H. Gribble)
Programs
-
Haskell
import Data.List (nub) a165909 n = sum $ nub $ map (`mod` n) $ take (fromInteger n) $ tail a000290_list -- Reinhard Zumkeller, Aug 01 2012
-
Mathematica
residueQ[n_, k_] := Length[Select[Range[Floor[k/2]], PowerMod[#, 2, k] == n&, 1]] == 1; a[n_] := Select[Range[n-1], residueQ[#, n]&] // Total; Array[a, 60] (* Jean-François Alcover, Mar 13 2019 *)
-
PARI
a(n) = sum(k=0, n-1, k*issquare(Mod(k,n))); \\ Michel Marcus, Mar 13 2019
Comments